PDA

View Full Version : QTextEdit with own wflags



Pan Wojtas
28th January 2006, 22:03
How can i create a new QTextEdit (as a new window - not child) with some extra wflags?
The constructor doesn't allow for this - it looks like this:
QTextEdit::QTextEdit( QWidget *parent, const char *name ) : QScrollView( parent, name, WStaticContents | WRepaintNoErase | WResizeNoErase )
I could use QWidget::setWFlags, but it doesn't work:
class AAA : public QTextEdit
{
Q_OBJECT

public:
AAA::AAA(QWidget * parent) : QTextEdit(parent, "")
{
setWFlags(WType_TopLevel | WNoAutoErase | WStyle_Customize | WX11BypassWM | WStyle_StaysOnTop | WDestructiveClose);

setText("aaa");
show();
}
};

AAA *a;
a = new AAA(0);
Qt creates normal window :confused:

jacek
28th January 2006, 22:08
You could create QVBox with customized flags and QTextEdit inside it.

Pan Wojtas
28th January 2006, 22:15
Yes, but i think it's a little bit stupid to create a new widget with QTextEdit inside, while QTextEdit is also a widget (and can be displayed as a new window as well).

Why QTextEdit's constructor doesn't allow to specify own wflags?

Chicken Blood Machine
30th January 2006, 22:09
You can use reparent() to change the flags. That should work.