Results 1 to 1 of 1

Thread: QLineEdit insight the QStatusBar problem

  1. #1
    Join Date
    Nov 2012
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QLineEdit insight the QStatusBar problem

    Hello. I have subclassed QMainWindow and in the Status bar I put a LineEdit.

    Qt Code:
    1. QLineEdit *lineEdit = new QLineEdit;
    2. statusBar()->addWidget(lineEdit);
    To copy to clipboard, switch view to plain text mode 

    The problem I have is that when I start the app the Status bar appears little bigger than it's normal size and after a second it becomes to the normal size. So I checked the sizeHint() of these two widgets:

    Qt Code:
    1. QLineEdit *lineEdit = new QLineEdit;
    2. qDebug() << statusBar()->minimumSizeHint(); // Status bar before adding the LineEdit's Height(22)
    3.  
    4. qDebug() << lineEdit->minimumSizeHint(); // LineEdit's Height (27)
    5. statusBar()->addWidget(lineEdit);
    6.  
    7. qDebug() << statusBar()->minimumSizeHint(); // Status bar after adding the LineEdit (32)
    To copy to clipboard, switch view to plain text mode 

    I saw that the LineEdit's height is bigger and the Status bar try to adjust the size. So I tried to set
    lineEdit->setFixedHeight(19) and
    statusBar->setFixedHeight(32) but it is still the same;

    I tried with the setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preffered) as well but nothing changed.

    I use Ubuntu 12.04 and the program was run with diffrent styles (Plastique, CleenLooks) but the result is the same.
    It's happening only when I have QLineEdit insight.

    One more thing:
    It happens mainly when I quit the app maximized or i switch from minimize to maximize. These are my Settings:

    Qt Code:
    1. void MainWindow::readSettings()
    2. {
    3.  
    4. QSettings settings("MySettings", "app");
    5. move(settings.value("position", QPoint(200, 200)).toPoint());
    6.  
    7. QByteArray windowGeometry = settings.value("geometry").toByteArray();
    8. restoreGeometry(windowGeometry);
    9.  
    10. QByteArray windowState = settings.value("state").toByteArray();
    11. restoreState(windowState);
    12.  
    13. }
    14.  
    15. //==========================================================================================
    16.  
    17. void MainWindow::writeSettings()
    18. {
    19.  
    20.  
    21. QSettings settings("MySettings", "app");
    22. settings.setValue("position", pos());
    23. settings.setValue("geometry", saveGeometry());
    24. settings.setValue("state", saveState());
    25. }
    To copy to clipboard, switch view to plain text mode 

    Can someone help me?
    Last edited by bazzdle; 8th November 2012 at 11:08. Reason: updated contents

Similar Threads

  1. QlineEdit + Sql Problem
    By anouar2002 in forum Newbie
    Replies: 15
    Last Post: 19th January 2012, 14:29
  2. QLineEdit problem
    By kumarpraveen in forum Newbie
    Replies: 5
    Last Post: 12th July 2010, 12:19
  3. Need some insight on making a graph using .txt file
    By soulz9 in forum Installation and Deployment
    Replies: 0
    Last Post: 14th April 2010, 09:46
  4. QStatusBar
    By newermind in forum Qt Programming
    Replies: 3
    Last Post: 1st June 2009, 21:48
  5. about QStatusBar
    By Pang in forum Qt Programming
    Replies: 1
    Last Post: 16th November 2006, 04:15

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.