Results 1 to 8 of 8

Thread: QWidget -> updateGeometry dont work.

  1. #1
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default QWidget -> updateGeometry dont work.

    I use a class flowlayout [ http://doc.trolltech.com/4.1/layouts...ayout-cpp.html ]
    to add invoice line (QList items & Propriety)

    My problem is QWidget -> updateGeometry() dont work!
    How i can solved?

    If i large the widget from hand ... dispay the result ok....



    Qt Code:
    1. /* the line wo i add .. */
    2. class ItemLine : public QWidget
    3.  
    4.  
    5. void Compose_Fak::RepainterWindowNow()
    6. {
    7. retranslateUi(this);
    8. updateGeometry();
    9. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QWidget -> updateGeometry dont work.

    if i repaint widget so ...

    Qt Code:
    1. void Compose_Fak::RepainterWindowNow()
    2. {
    3. int xh = height();
    4. int xw = width();
    5. resize(xw + 5,xh);
    6. resize(xw,xh);
    7. }
    To copy to clipboard, switch view to plain text mode 

    works ok....

    but exist other solution?

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QWidget -> updateGeometry dont work.

    When do you call that Compose_Fak::RepainterWindowNow() method? Maybe you block the event loop somewhere?

  4. #4
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QWidget -> updateGeometry dont work.

    Quote Originally Posted by jacek
    When do you call that Compose_Fak::RepainterWindowNow() method? Maybe you block the event loop somewhere?
    is possibel... is on same time...

    Qt Code:
    1. connect( aggiungilineax, SIGNAL( clicked() ),this, SLOT( AppendLine()));
    2. connect( aggiungilineax, SIGNAL( clicked() ),this, SLOT( RepainterWindowNow()));
    To copy to clipboard, switch view to plain text mode 

    i test on emit at end of RepainterWindowNow....


    it compliments for Your Master's Degree in Computer Science ...
    Last edited by patrik08; 13th July 2006 at 18:18.

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QWidget -> updateGeometry dont work.

    Quote Originally Posted by patrik08
    connect( aggiungilineax, SIGNAL( clicked() ),this, SLOT( RepainterWindowNow()));
    When you trigger that slot using clicked() signal, then it means that updateGeometry() doesn't work for some other reason.

    Why do you want to invoke it anyway?

  6. #6
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QWidget -> updateGeometry dont work.

    Quote Originally Posted by jacek
    When you trigger that slot using clicked() signal, then it means that updateGeometry() doesn't work for some other reason.
    Why do you want to invoke it anyway?
    it compliments for Your Master's Degree in Computer Science ...


    Work if the screen qwidget is not fullscreen ... by fullscren is same as pictures ..
    http://ppk.ciz.ch/format/images/flowlayout_line.png


    Qt Code:
    1. void Compose_Fak::RepainterWindowNow()
    2. {
    3. int xh = height(); /* incomming emit ReloadPageFull() */
    4. int xw = width();
    5. resize(xw + 10,xh);
    6. resize(xw,xh);
    7. }
    8.  
    9. void Compose_Fak::AppendLine()
    10. {
    11. int sumflow = flow->count();
    12. if ( sumflow < 9) {
    13. summlinerfak++;
    14. fiocco = new ItemLine(piano_centrale);
    15. fiocco->setNumerate(summlinerfak);
    16. fiocco->setTitle("Testo di descrizione");
    17. fiocco->setQuant(2.5);
    18. fiocco->setUnitprice(1.16);
    19. flow->addWidget(fiocco);
    20. /*QSize actualf = flow->sizeHint();
    21.   int hsww = actualf.height();
    22.   int wsww = actualf.width();
    23.   qDebug() << "### misura .. alto=" << hsww << " largo=" << wsww; */
    24. lines.append( fiocco ); /* QList<ItemLine *> lines; */
    25. } else {
    26. aggiungilineax->setDisabled (true); /* disable button */
    27. }
    28. emit ReloadPageFull();
    29. }
    To copy to clipboard, switch view to plain text mode 

  7. #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: QWidget -> updateGeometry dont work.

    Quote Originally Posted by patrik08 View Post
    I use a class flowlayout [ http://doc.trolltech.com/4.1/layouts...ayout-cpp.html ]
    to add invoice line (QList items & Propriety)

    My problem is QWidget -> updateGeometry() dont work!
    How i can solved?

    If i large the widget from hand ... dispay the result ok....



    Qt Code:
    1. /* the line wo i add .. */
    2. class ItemLine : public QWidget
    3.  
    4.  
    5. void Compose_Fak::RepainterWindowNow()
    6. {
    7. retranslateUi(this);
    8. updateGeometry();
    9. }
    To copy to clipboard, switch view to plain text mode 
    Hi I can help with qmake.net I'm Italian
    Franco Amato

  8. #8
    Join Date
    May 2011
    Location
    near munich
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QWidget -> updateGeometry dont work.

    Quote Originally Posted by patrik08 View Post
    if i repaint widget so ...

    Qt Code:
    1. void Compose_Fak::RepainterWindowNow()
    2. {
    3. int xh = height();
    4. int xw = width();
    5. resize(xw + 5,xh);
    6. resize(xw,xh);
    7. }
    To copy to clipboard, switch view to plain text mode 

    works ok....

    but exist other solution?

    I had the same problem and "adjustSize()" on the parent widget did the trick (Qt4.8). (I know this thread is really old, but perhaps it helps someone.)

Similar Threads

  1. Replies: 1
    Last Post: 2nd May 2006, 22:11
  2. size issues for custom QWidget in QScrollArea
    By anotheruser in forum Qt Programming
    Replies: 1
    Last Post: 27th April 2006, 15:52
  3. moving QWidget and Mainform
    By mickey in forum Newbie
    Replies: 9
    Last Post: 6th April 2006, 18:54
  4. QScrollArea problem positioning a QWidget inside
    By Spectator in forum Qt Programming
    Replies: 4
    Last Post: 20th February 2006, 23:59
  5. QTextEdit Justify align making work
    By dec0ding in forum Qt Programming
    Replies: 2
    Last Post: 13th January 2006, 13:02

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.