Can one unset a widget attribute such as Qt::WA_MacShowFocusRect globally?



  • I'm creating a gui for use on os x and one of the most annoying features of the QMacStyle is the mac focus frame.

    I unset this attribute for every widget i use, but its getting annoying to do and especially when using composite widgets such as QTabWidget that is comprised of several child widgets.

    Can it be unset globally? Or perhaps for all child widgets of a widget?



  • No, but you can use some simple code to disable for all your widgets.

    For all your top-level windows, do something like this:

    @
    QWidgetList widgets = myTopLevelWidget->findChildren<QWidget*>();
    foreach(QWidget* widget, widgets)
    //unset your flag
    @

    Access to all top level widgets can be gotten from QApplication.



  • Thanks :) That worked nicely!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.