MDI ideas / suggestions wanted
-
EDIT
Could somebody PLEASE at least comment on this crazy idea
I can pass Qt::WindowFlags to :addSubWindow as a addition ID and later
verify the ID ....I am not sure if messing with Qt::WindowFlags() won't create some other issues.
QMdiSubWindow *QMdiArea::addSubWindow(QWidget *widget, Qt::WindowFlags windowFlags = Qt::WindowFlags())
I am looking for somebody who knows / uses MDI Qt example.
The example is build around the idea to have multiple "text file editing " application.
Does the job.I like to expand on the idea and have similar , multiple access, application using Bluetooth technology.
The multiple "text file editing " concept is done adding another layer AFTER "mdiArea" and is implemented by
"child" object based on QEditText.The menu "Window" provides for controlling the appearance of the multiple "children" in the main mdiArea - such as "tile " , "cascade" etc.
In reality - the "Bluetooth" menu would have "submenu" and each item ( action) in such submenu wound "need" a "child" object to handle specific submenu.
At present I can add "mdiSubmenu" but the code which instantiates the "Window" is failing because the QEditText and my (first) specific Bluetooth object (btscanner) do not have SAME "text retrieval" functions.
In an essence - should I struggle to modify current , working "window"function or just build another - especially for specific Bluetooth object ( dialog) ?
I am NOT asking for a code , just an idea.
( I do hesitate to post current code - it has TOO many "debugs" lines of code....)
-
@AnneRanch said in MDI ideas / suggestions wanted:
I can pass Qt::WindowFlags to :addSubWindow as a addition ID and later verify the ID ....
At present I can add "mdiSubmenu" but the code which instantiates the "Window" is failing because the QEditText and my (first) specific Bluetooth object (btscanner) do not have SAME "text retrieval" functions.
It is your code that is making the assumption that all QMdiSubWindows contain a widget with the same API. Clearly that is not the case in your program, so this assumption is flawed.
Subverting the window flags of MDI subwindows to implement some sort of run-time type identifier is not a useful idea.
Qt already provides a way to determine the class of the widget inside a QMdiSubWindow. Something like this for example,
QMdiSubWindow *currentSub = mdiArea->currentSubWindow(); QWidget *currentWidget = currentSub->widget(); if (QTextEdit *edit = qobject_cast<QTextEdit*>(currentWidget)) { // code to work with editors } else if (BlueToothWidget *bt = qobject_cast<BlueToothWidget*>(currentWidget)) { // code to work with the bluetooth widget } else { qWarning("Unknown subwindow type seen. Doing nothing."); }
-
@AnneRanch said in MDI ideas / suggestions wanted:
I can pass Qt::WindowFlags to :addSubWindow as a addition ID and later verify the ID ....
At present I can add "mdiSubmenu" but the code which instantiates the "Window" is failing because the QEditText and my (first) specific Bluetooth object (btscanner) do not have SAME "text retrieval" functions.
It is your code that is making the assumption that all QMdiSubWindows contain a widget with the same API. Clearly that is not the case in your program, so this assumption is flawed.
Subverting the window flags of MDI subwindows to implement some sort of run-time type identifier is not a useful idea.
Qt already provides a way to determine the class of the widget inside a QMdiSubWindow. Something like this for example,
QMdiSubWindow *currentSub = mdiArea->currentSubWindow(); QWidget *currentWidget = currentSub->widget(); if (QTextEdit *edit = qobject_cast<QTextEdit*>(currentWidget)) { // code to work with editors } else if (BlueToothWidget *bt = qobject_cast<BlueToothWidget*>(currentWidget)) { // code to work with the bluetooth widget } else { qWarning("Unknown subwindow type seen. Doing nothing."); }
@ChrisW67 Thanks Chris
I was just about to delete this post...
I have a confession - have been IGNORING the MDI example code you are referencing...
it is all in there ...
I went thru it line by line , added some comments and
I got it working with some superficial modifications...
THANKS( I owe you a beer,,, and if you are ever near Houston hope we will meet .. ,)