PDA

View Full Version : Set QPlaiTextEdit as central widget in QT Designer



Suppaman
2nd December 2011, 09:15
Hi all

Just finished to search into the forum for similar problem but not found satisfying reply. I need to create a SDI like application. I'm creating the main window using QT Designer but I still didin't find a way for set a QPlainTextEdit control as central widget. For similar request someone suggested to drop the text widget over central widget, set the central widget layout vertical or horizontal mode and set text widget as expanding. This work but not complitely. I mean, using this way the text widget is automatically centered and resized based to the main window size but doesn't fill all the central widget area. Borders still appears around the text widget and doesn't look like a real SDI application where the text control fill all the entire area of the central window part.

Someone have a solution for this problem?

Thank you

myta212
2nd December 2011, 09:52
Hi,
You can set contents margin layout with 0 like this :


centralwidget = new QWidget(MainWindow);
gridLayout->setSpacing(0);
gridLayout->setContentsMargins(0, 0, 0, 0);


And set QPlainTextEdit frameShape to QFrame::NoFrame.


plainTextEdit->setFrameShape(QFrame::NoFrame);
plainTextEdit->setLineWidth(0);


Are this metod solve your problem?
Thank you.

Best regards,

Toto

Suppaman
2nd December 2011, 10:12
Hi Toto

Thank you very much for your suggestion.

Basically the problem was not in QT Designer but in my mind since I'm an idiot and I should to check better the available widgets properties before annoy other users in the forum. :o

I didn't use your coding solution since, thanks to your input, I found the layour margins properties in QT Designed that allow me to set the text control inside central widget to fill the entire area of the window (setting all the left, right, top and bottom margin values of central widget as zero).

Thank you very much again for your help