Results 1 to 3 of 3

Thread: QMenu behaving differently on different platforms

  1. #1
    Join Date
    Aug 2021
    Posts
    2
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11

    Question QMenu behaving differently on different platforms

    Hi!

    Im working on a project that will run on an embedded linux device. On the GUI that Im building I have a QPushButton that has a QMenu that is populated with a bunch of QWidgetActions.

    On my desktop (Kubuntu 18.04 LTS) the QMenu just paints the QWidgets associated with the QWidgetActions in the QMenu (And this is the behaviour that I want)

    On a Windows 10 machine the QMenu paints the QWidgets but it puts a border around them. This border can be deleted with
    Qt Code:
    1. m_pMenu->setStyleSheet( "border: 0;" );
    To copy to clipboard, switch view to plain text mode 

    On my embedded linux device (I run the application directly on the framebuffer) the QMenu paints the QWidgets but it puts a border around them but I cant turn the border off with the StyleSheet code that works on Windows.

    Any ideas on what to do? I need to remove the border on the embedded linux device. QT Version on the embedded device is 5.12

    Thanks!

  2. #2
    Join Date
    Jun 2012
    Location
    Austria
    Posts
    22
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QMenu behaving differently on different platforms

    Hi cRay, could you explain in detail what you mean with "a QPushButton that has a QMenu"? Are you creating a QMenu like a context menu when the button is clicked? Just a weird idea: if you create the QMenu without parent, Qt probably creates a top level window where the decoration depends on the window manager of the system. Do you use QMenu:opup or QMenu::exec ?

  3. #3
    Join Date
    Aug 2021
    Posts
    2
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: QMenu behaving differently on different platforms

    I solved it, I added "-style Fusion" to the command line that started the app on the embedded system.

    QPushButton has a method called "setMenu( QMenu* )" and by default it will show the menu once clicked, thats how I use it.

Similar Threads

  1. QTabWidget style each tab differently
    By MichaH in forum Qt Programming
    Replies: 2
    Last Post: 11th October 2016, 10:24
  2. Replies: 0
    Last Post: 4th April 2012, 12:55
  3. QStringList::contains() not behaving as expected
    By JPNaude in forum Qt Programming
    Replies: 1
    Last Post: 7th November 2011, 10:30
  4. Derived class from QLineEdit is behaving differently.
    By savaliya_ambani in forum Qt for Embedded and Mobile
    Replies: 3
    Last Post: 21st January 2011, 09:40
  5. Modal dialog not behaving
    By tpf80 in forum Qt Programming
    Replies: 7
    Last Post: 16th September 2008, 23:03

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.