Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » opening a new window/dialog: for newbies
opening a new window/dialog: for newbies [message #204067] Sun, 04 November 2007 22:29
Nick Schweyer is currently offline Nick SchweyerFriend
Messages: 175
Registered: July 2009
Senior Member
hello,

some time ago I had a typical newbie-problem for which I have the solution
here. Maybe it is useful for other newbies.

Problem:
For the display of the content of text files I had generated a new widget
with a QTextEdit, a button and a checkbox, called Ui::TextView. This was
done with Qt-Designer.
To customize this widget I declared a new class TextViewer with double
inheritance from the classes QWidget and Ui::TextView:
class TextViewer : public QWidget, public Ui::TextView

Showing this widget in my program only showed the QTextEdit-box, the
button and the checkbox but no frame around it. The widget worked but it
could not be moved around because the frame around it was missing.

Solution:
Double inheritance from QDialog and Ui::TextView instead of QWidget and
Ui::TextView:
class TextViewer : public QDialog, public Ui::TextView


A further tip:
The difference between generation of such an object within the main-window
like
TextViewer *viewFile;
viewFile = new TextViewer;
and
TextViewer *viewFile;
viewFile = new TextViewer(this);
is the following:
In the first version the widget will be "autonomous", i.e. independent
from the main-window. This means that it is displayed on the screen but it
may be hidden by the main window. In practice you may have to move the
main-window around to see the new widget.
In the second version the object viewFile will always be visible in front
of the main-window because it belongs to the main-window which is more
comfortable .

Nikosch


Niko

Eclipse-CDT Version: 2019-12 (4.14.0), Win10 64bit
Previous Topic:how to split source and object directory
Next Topic:Setup CDT for large scale dev team
Goto Forum:
  


Current Time: Tue Sep 17 11:33:58 GMT 2024

Powered by FUDForum. Page generated in 0.03184 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top