Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-18993

Add key() Member Function to QStyle (sub)classes

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Fixed
    • Not Evaluated
    • 6.1.0 Beta 1
    • 4.7.2
    • GUI: Look'n'Feel
    • None

    Description

      If you want to save the current QStyle of your Application to the Settings you have to use something like this:

       
      QStyle *style = qApp->style();
      
      QString styleKey;
      
      if(dynamic_cast<MyStyle*>(style) != NULL)
          styleKey = "MyStyle";
      else if(dynamic_cast< QPlastiqueStyle*>(style) != NULL)
          styleKey = "Plastique";    
      else if(dynamic_cast<QWindowsXPStyle*>(style) != NULL)
          styleKey = "WindowsXP";
      [...]
      
      settings.setValue("WidgetStyle",styleKey);
      
      

      It would be nice to have a member function (eg. virtual QString key()) which will return the key identical to the QStyleFactor::keys() function.
      So you only have to call QString styleKey = qApp->style()->key(); to get the key.

      And simply with QStyleFactor::create(key) you can restore

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              chehrlic Christian Ehrlicher
              chrisigleich Christian Delis
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes