What I want to achieve is this:
pic.png
The second TextEdit needs a spacer in a horizontal layout for this. I've made a layout like this:
hLayout
->addWidget
((QTextEdit*)itemText
);
//Just fyi: itemText is an object of class that extends QTextEdit.
QHBoxLayout* hLayout = new QHBoxLayout();
hLayout->addItem(new QSpacerItem(16, 64, QSizePolicy::Fixed, QSizePolicy::Fixed));
hLayout->addWidget((QTextEdit*)itemText); //Just fyi: itemText is an object of class that extends QTextEdit.
To copy to clipboard, switch view to plain text mode
and tried to add it to an existing (vertical)layout that is set on the ScrollArea.
ui->scrollArea->widget()->layout()->addItem(hLayout);
ui->scrollArea->widget()->layout()->addItem(hLayout);
To copy to clipboard, switch view to plain text mode
But it only adds empty space with the height of spacer. Why doesn't the QTextEdit object appear?
Bookmarks