Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QWidgetAction show error

QWidgetAction show error

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 351 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ivanicyI Offline
    ivanicyI Offline
    ivanicy
    wrote on last edited by
    #1

    Hello!

    I have created a custom widget to show it when I open a QMenu inside a QPushButton. This is the widget:

    f9fa4f3f-a294-4548-95fe-6c5f7c8374d2-image.png

    When I open it with the QPushButton, it appears at follows:

    4712a0db-b1bf-4955-bf23-766beb0f6071-image.png

    I don't know why it changes the widgets order and why the down arrow appears in the left side.

    This is my code:

        QMenu *menu = new QMenu(ui->buttonReports);
        ui->buttonReports->setMenu(menu);
        WidgetReports *wReports = new WidgetReports(menu);
        QWidgetAction *wAction = new QWidgetAction(menu);
        wAction->setDefaultWidget(wReports);
        menu->addAction(wAction);
    

    What am I doing wrong?

    Thank you very much!

    M 1 Reply Last reply
    0
    • ivanicyI ivanicy

      Hello!

      I have created a custom widget to show it when I open a QMenu inside a QPushButton. This is the widget:

      f9fa4f3f-a294-4548-95fe-6c5f7c8374d2-image.png

      When I open it with the QPushButton, it appears at follows:

      4712a0db-b1bf-4955-bf23-766beb0f6071-image.png

      I don't know why it changes the widgets order and why the down arrow appears in the left side.

      This is my code:

          QMenu *menu = new QMenu(ui->buttonReports);
          ui->buttonReports->setMenu(menu);
          WidgetReports *wReports = new WidgetReports(menu);
          QWidgetAction *wAction = new QWidgetAction(menu);
          wAction->setDefaultWidget(wReports);
          menu->addAction(wAction);
      

      What am I doing wrong?

      Thank you very much!

      M Offline
      M Offline
      mpergand
      wrote on last edited by mpergand
      #2

      @ivanicy
      Check the layoutDirection property value of your custom widget in the Designer, seems to be set to right to left.
      But, if it was the case, it should look inverted as well in the Designer itself.
      Strange...

      1 Reply Last reply
      2
      • ivanicyI Offline
        ivanicyI Offline
        ivanicy
        wrote on last edited by
        #3

        Yeah! It was because the button. I had it right to left so the menu was showed right to left too. Damn copy and paste...

        Thank you very much!

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved