Results 1 to 13 of 13

Thread: How to divide a status bar in parts

  1. #1
    Join Date
    Nov 2007
    Location
    Italy
    Posts
    691
    Thanks
    59
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default How to divide a status bar in parts

    Hi to all,
    I would create a status bar in my application and I would have 3 parts on it to add different messanges per part.
    I also would add a little image in one of them.
    How can I do it?
    Best Regards,
    Franco
    Franco Amato

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: How to divide a status bar in parts


  3. #3
    Join Date
    Nov 2007
    Location
    Italy
    Posts
    691
    Thanks
    59
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to divide a status bar in parts

    Quote Originally Posted by Lykurg View Post
    Dear Lykurg,
    is not exactly what I need. What I need is divide my status bar in 3 parts as you can see in this image:
    http://www.lgiris.com/ps/products/idata/idataeac.htm
    look at ths status bar of the software in the link. I would reproduce the same behavior.
    Regards
    Franco Amato

  4. #4
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: How to divide a status bar in parts

    Oh please, could you try at least read the small portions of documentation I pointed you? It is exactly what you need! Add three widgets and you have split your status bar up. With the stretch you can control the width of the widgets. Or if you like you can only add one widget for the whole space. Then this widget must divide itself into three parts etc.

  5. The following user says thank you to Lykurg for this useful post:

    franco.amato (24th January 2011)

  6. #5
    Join Date
    Nov 2007
    Location
    Italy
    Posts
    691
    Thanks
    59
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to divide a status bar in parts

    Quote Originally Posted by Lykurg View Post
    Oh please, could you try at least read the small portions of documentation I pointed you? It is exactly what you need! Add three widgets and you have split your status bar up. With the stretch you can control the width of the widgets. Or if you like you can only add one widget for the whole space. Then this widget must divide itself into three parts etc.
    Ah sorry I didn't get you before. For example with wxWidget you can explicitly split a status bar without adding widgets and refer to them as index 0 to n-1.
    Thanx
    Franco Amato

  7. #6
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to divide a status bar in parts

    Did you actually try QStatusBar::addPermanentWidget() or QStatusBar::insertWidget() a couple of times before proclaiming that it did not give you the solution to your problem?
    Qt Code:
    1. #include <QtGui>
    2. #include <QDebug>
    3.  
    4. class MainWindow: public QMainWindow {
    5. Q_OBJECT
    6. public:
    7. MainWindow(QWidget *p = 0): QMainWindow(p) {
    8. QWidget *central = new QWidget(this);
    9. setCentralWidget(central);
    10.  
    11. // Do multipart status bar
    12. m_statusLeft = new QLabel("Left", this);
    13. m_statusLeft->setFrameStyle(QFrame::Panel | QFrame::Sunken);
    14. m_statusMiddle = new QLabel("Middle", this);
    15. m_statusMiddle->setFrameStyle(QFrame::Panel | QFrame::Sunken);
    16. m_statusRight = new QLabel("Right", this);
    17. m_statusRight->setFrameStyle(QFrame::Panel | QFrame::Sunken);
    18. statusBar()->addPermanentWidget(m_statusLeft, 1);
    19. statusBar()->addPermanentWidget(m_statusMiddle, 1);
    20. statusBar()->addPermanentWidget(m_statusRight, 2);
    21. }
    22. public slots:
    23. private:
    24. QLabel * m_statusLeft;
    25. QLabel * m_statusMiddle;
    26. QLabel * m_statusRight;
    27. };
    28.  
    29. int main(int argc, char *argv[])
    30. {
    31. QApplication app(argc, argv);
    32.  
    33. MainWindow m;
    34. m.show();
    35. return app.exec();
    36. }
    37. #include "main.moc"
    To copy to clipboard, switch view to plain text mode 

  8. The following user says thank you to ChrisW67 for this useful post:

    franco.amato (24th January 2011)

  9. #7
    Join Date
    Nov 2007
    Location
    Italy
    Posts
    691
    Thanks
    59
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to divide a status bar in parts

    Cris I told to Lykurg that I didn't understand well before the last post so please read my post before to reply thank you.
    Regards
    Franco Amato

  10. #8
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to divide a status bar in parts

    Both Lykurg's reply and your reply were posted while I was writing mine (amongst answering phones for work). Unfortunately there is no delete post so that I could remove the now unneeded response.

  11. #9
    Join Date
    Nov 2007
    Location
    Italy
    Posts
    691
    Thanks
    59
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to divide a status bar in parts

    Quote Originally Posted by ChrisW67 View Post
    Both Lykurg's reply and your reply were posted while I was writing mine (amongst answering phones for work). Unfortunately there is no delete post so that I could remove the now unneeded response.
    Hi Chris I know, doesn't matter. For that I proposed to wysota to add such feature but he doens't want.
    Meanwhile thank you very much for the example, it's very usefull.
    Regards
    Franco Amato

  12. #10
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: How to divide a status bar in parts

    Quote Originally Posted by franco.amato View Post
    For that I proposed to wysota to add such feature but he doens't want.
    We don't need such a feature. Based on the time stamp one can imagine that it was posted at the "same" time and everybody has the posibillity to edit his post and add something like "EDIT: too late...". Then all is clear. And besides: It is good that ChrisW67 hasn't delete his message, because of the code example!

  13. #11
    Join Date
    Nov 2007
    Location
    Italy
    Posts
    691
    Thanks
    59
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to divide a status bar in parts

    Hi,
    how is possible to change the text of one of the parts when the application is running?
    And how is possible to add a small icon again when running?
    Regards
    Franco Amato

  14. #12
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to divide a status bar in parts

    Quote Originally Posted by Lykurg View Post
    We don't need such a feature. Based on the time stamp one can imagine that it was posted at the "same" time and everybody has the posibillity to edit his post and add something like "EDIT: too late...". Then all is clear.
    The "Preview Post" button can do miracles in this situation

    Quote Originally Posted by franco.amato View Post
    Hi,
    how is possible to change the text of one of the parts when the application is running?
    And how is possible to add a small icon again when running?
    The "parts" are usually labels. You know how to change text of a label or add an icon to it, right?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  15. #13
    Join Date
    Nov 2007
    Location
    Italy
    Posts
    691
    Thanks
    59
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to divide a status bar in parts

    Yes Wysota I solved. Thank you very much.
    Best
    Franco Amato

Similar Threads

  1. Replies: 3
    Last Post: 8th July 2010, 07:41
  2. how to configure only some few parts of the Qt?
    By FS Lover in forum Installation and Deployment
    Replies: 6
    Last Post: 29th November 2009, 17:13
  3. Qt project with .net parts(vs2008)
    By deemeetar in forum Newbie
    Replies: 0
    Last Post: 29th September 2009, 12:30
  4. how to disable building some parts of qt
    By FS Lover in forum Installation and Deployment
    Replies: 6
    Last Post: 16th July 2009, 15:21
  5. Display and divide the image
    By kiransu123 in forum Qt Programming
    Replies: 19
    Last Post: 5th March 2007, 20:40

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.