Results 1 to 3 of 3

Thread: How to dynamically resize a QDeclarativeView Rectangle to my QWidget size ?

  1. #1
    Join Date
    Apr 2011
    Posts
    61
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default How to dynamically resize a QDeclarativeView Rectangle to my QWidget size ?

    I'm showing content of my application that loads file and show the names, values, etc.
    I'm trying to learn and use qml, I was using QWebView.

    I'm resizing the widget elements manually with a line that lets you "move" it resizing a TreeWidget (in the left side) and the "View" (in the right side):

    Qt Code:
    1. void MapBrowser::redoLayout(const QSize& twsize, const QSize& wvsize)
    2. {
    3. static int padleft = ui->treeWidget->x();
    4. static int padmid = ui->line->x() - ui->treeWidget->x() - ui->treeWidget->width();
    5.  
    6. if (this->size() == this->minimumSize()) return;
    7.  
    8. if (twsize.width() < ui->treeWidget->minimumSize().width()) return;
    9. if (wvsize.width() < ui->declarativeView->minimumSize().width()) return;
    10. //if (wvsize.width() < ui->webView->minimumSize().width()) return;
    11.  
    12. ui->treeWidget->resize(twsize);
    13. ui->declarativeView->resize(wvsize);
    14. //ui->webView->resize(wvsize);
    15.  
    16. QPoint twmove(padleft, ui->treeWidget->y());
    17. QPoint lnmove(ui->treeWidget->x() + ui->treeWidget->width() + padmid, ui->line->y());
    18. QPoint wvmove(ui->line->x() + ui->line->width() + padmid, ui->declarativeView->y());
    19. //QPoint wvmove(ui->line->x() + ui->line->width() + padmid, ui->webView->y());
    20.  
    21. ui->treeWidget->move(twmove);
    22. ui->line->move(lnmove);
    23. ui->declarativeView->move(wvmove);
    24. //ui->webView->move(wvmove);
    25. }
    To copy to clipboard, switch view to plain text mode 

    But, my problem is:
    I need to update the size of the main Rectangle, how can I do this ?

  2. #2
    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 dynamically resize a QDeclarativeView Rectangle to my QWidget size ?

    You scale the root object of the declarative view.
    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.


  3. #3
    Join Date
    Apr 2011
    Posts
    61
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to dynamically resize a QDeclarativeView Rectangle to my QWidget size ?

    I've temporally switched back to QWebView. Because I want the labels to act like a normal "<span>".
    But they aren't selectable and i'm not finding a way to copy and other things.
    Is that possible make a "page" in QML like a html right ?

    If it's possible what would be better ? Creating a html and changing some content with .arg() or javascript.
    Or using QML <=> C++ ?

Similar Threads

  1. Replies: 6
    Last Post: 7th February 2012, 03:03
  2. Dynamically resize text
    By antialias_forum in forum Qt Quick
    Replies: 4
    Last Post: 7th May 2011, 00:37
  3. How to resize the QIcon inside QPushButton dynamically?
    By gboelter in forum Qt Programming
    Replies: 2
    Last Post: 18th February 2010, 13:34
  4. Dynamically resize spacing
    By trskel in forum Qt Programming
    Replies: 6
    Last Post: 28th September 2007, 12:52

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.