View Full Version : How to dynamically resize a QDeclarativeView Rectangle to my QWidget size ?

9th May 2011, 00:59
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):

void MapBrowser::redoLayout(const QSize& twsize, const QSize& wvsize)
static int padleft = ui->treeWidget->x();
static int padmid = ui->line->x() - ui->treeWidget->x() - ui->treeWidget->width();

if (this->size() == this->minimumSize()) return;

if (twsize.width() < ui->treeWidget->minimumSize().width()) return;
if (wvsize.width() < ui->declarativeView->minimumSize().width()) return;
//if (wvsize.width() < ui->webView->minimumSize().width()) return;


QPoint twmove(padleft, ui->treeWidget->y());
QPoint lnmove(ui->treeWidget->x() + ui->treeWidget->width() + padmid, ui->line->y());
QPoint wvmove(ui->line->x() + ui->line->width() + padmid, ui->declarativeView->y());
//QPoint wvmove(ui->line->x() + ui->line->width() + padmid, ui->webView->y());


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

9th May 2011, 02:28
You scale the root object of the declarative view.

9th May 2011, 03:04
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++ ?