Results 1 to 2 of 2

Thread: Widgets Layout in a QToolBar.

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2008
    Location
    Rome, Italy
    Posts
    95
    Thanks
    19
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Widgets Layout in a QToolBar.

    Hi to all,
    I've inserted, via code, a QLabel and QLineEdit in a QToolBar as showed in the next screenshot:



    but I'd like to line up vertically both QLabel and QLineEdit:



    so I've tried the following code:

    Qt Code:
    1. void frmEntUsc::creaToolBar()
    2. {
    3. QLabel * lblRicerca;
    4. lblRicerca = new QLabel();
    5. lblRicerca->setText(QString::fromUtf8("Ricerca per Data: "));
    6. lblRicerca->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
    7.  
    8. ricData = new QDateEdit();
    9. ricData->setMinimumSize(QSize(100, 20));
    10. ricData->setMaximumSize(QSize(100, 20));
    11. ricData->setWrapping(false);
    12. ricData->setFrame(true);
    13. ricData->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
    14. ricData->setButtonSymbols(QAbstractSpinBox::UpDownArrows);
    15. ricData->setAccelerated(true);
    16. ricData->setCalendarPopup(true);
    17. ricData->setDate(QDate::currentDate());
    18.  
    19. ui.editToolBar->insertWidget(ui.action_Ricerca, lblRicerca);
    20. ui.editToolBar->insertWidget(ui.action_Ricerca, ricData);
    21. ui.editToolBar->insertSeparator(ui.action_Stampa);
    22.  
    23. vLayout = new QVBoxLayout();
    24. vLayout->addWidget(lblRicerca);
    25. vLayout->addWidget(ricData);
    26.  
    27. connect(ui.action_Ricerca, SIGNAL(triggered()),
    28. this, SLOT(appFiltro()));
    29.  
    30. connect(ricData, SIGNAL(dateChanged(QDate)),
    31. this, SLOT(cambioData(QDate)));
    32. }
    To copy to clipboard, switch view to plain text mode 

    but nothing happened!!!
    How can I line up those widgets?
    Attached Images Attached Images

Similar Threads

  1. Layout, widgets and resize questions
    By Carlsberg in forum Qt Programming
    Replies: 2
    Last Post: 26th June 2009, 12:49
  2. remove widgets from layout in run time
    By bindigi01 in forum Qt Programming
    Replies: 10
    Last Post: 6th June 2009, 22:36
  3. Replies: 1
    Last Post: 14th May 2009, 22:00
  4. Custom widgets in layout
    By Palmik in forum Newbie
    Replies: 11
    Last Post: 26th January 2009, 12:08
  5. Promoted widgets and layout boxes
    By notsonerdysunny in forum Qt Tools
    Replies: 3
    Last Post: 2nd May 2007, 14:15

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.