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

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

XMLWordPrintable

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

      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

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

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes