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):
Code:
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;
ui->treeWidget->resize(twsize);
ui->declarativeView->resize(wvsize);
//ui->webView->resize(wvsize);
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());
ui->treeWidget->move(twmove);
ui->line->move(lnmove);
ui->declarativeView->move(wvmove);
//ui->webView->move(wvmove);
}
But, my problem is:
I need to update the size of the main Rectangle, how can I do this ?
Re: How to dynamically resize a QDeclarativeView Rectangle to my QWidget size ?
You scale the root object of the declarative view.
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++ ?