softs
softs

Reputation: 11

Qt MenuBar highlight border with motif style

I have a QMenuBar with two sub menus using the motif style (Qt 5.3). A black border appears around the QMenuBar when following this scenario (example code below):

  1. Click sub menu "Foo1"
  2. Click sub menu "Bar1"

The border appears after clicking on "Bar1". This seems to be a highlight or focus border. The border goes away while the window is being moved with the mouse but it returns when finished moving.

Image of black border on menubar1:

menubar with offending black border

I would like to know how to get rid of this border, if possible without using the stylesheet, since using the stylesheet clears the motif style.

Here is the example code:

#include <QApplication>
#include <QMainWindow>
#include <QMenuBar>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    a.setStyle("motif");
    QMainWindow w;

    w.setFixedSize(700,300);

    QMenuBar *menubar1 = new QMenuBar(&w);
    menubar1->setFixedSize(500,30);
    menubar1->addMenu("Foo1");
    menubar1->addMenu("Bar1");

    QMenuBar *menubar2 = new QMenuBar(&w);
    menubar2->setFixedSize(500,30);
    menubar2->move(0,80);
    menubar2->addMenu("Foo2");
    menubar2->addMenu("Bar2");

    w.show();
    return a.exec();
}

Upvotes: 1

Views: 426

Answers (0)

Related Questions