Unsolved Combining widgets
-
Can i combining different widgets, as in AdobePhotoshop when i сreate new project?
-
Hi Tettra,
Welcome to the Qt forum.
What is it you like in Photoshop exactly when combining widgets?
-
-
@TETTRA Thanks for the picture, but could you explain a little more what you want to do?
-
There is a window that can connect to the main widget. How this repeat? And they are united in one window.
-
-
@VRonin Do you use AdobePhotoshop? There different windows. When a new project is created, it appears as a separate window and then it is merged with the main window.
-
@TETTRA said in Combining widgets:
Do you use AdobePhotoshop?
I'm not that rich.
I think what you mean can be achieved either reimplemnting drag and drop or using QMainWindow as a central widget of another QMainWindow and spawning QDockWidgets from it
-
@VRonin Excuse me but I didn'i understand a bit. Can you give me some example?
-
Something like:
class ExampleWid : QMainWindow{ Q_OBJECT Q_DISABLE_COPY(ExampleWid) public: explicit ExampleWid(QWidget* parent = Q_NULLPTR) :QMainWindow(parent) { m_centralWid=new QMainWindow(this); m_centralWid->setWindowFlags(Qt::Widget); setCentralWidget(m_centralWid); } public slots: void spawnWidget(){ auto tempLabel = new QLabel("exaple"); auto tempDock = new QDockWidget("example dock"); tempDock.setWidget(tempLabel); m_centralWid->addDockWidget(Qt::NoDockWidgetArea,tempDock); } private: QMainWindow* m_centralWid; };
call
spawnWidget
to create new windowsEdit
addDockWidget shold be called from the central widget
-
@VRonin It's not what it takes. Sorry
-
@TETTRA
Hi
You really have to explain a bit better what you want. :)I do use photoshop cc 2014 and i have no idea what you mean.
You mean tear off windows, ( from a tab ) to a floating window and then be able to drag back again to a tab ?
-
@mrjj Exactly this!!!!!
-
@TETTRA
Ok. Then @VRonin code is the way to go.
Its not directly supported by the Docks. (to dock in center)
They will only docks to the sides. ( and only dock in mainwindows)
But it is possible to cheat and and use an extra mainwindow and use that for the central docking so
one can get that effect. But it takes some tweaking and fiddling to get it to work. -
Can you tell me how to do this? Give some kind of example, pls
-
@TETTRA
There is no premade , just to use solution. ( that i have seen)
The code @VRonin provide is a good starting point.You should read about QDockWidget and how it works. Then
try to make it.http://doc.qt.io/qt-5/qdockwidget.html
this one also cover it.
http://www.informit.com/articles/article.aspx?p=1405543&seqNum=5If you are brand new to Qt, it's not a good start project as such as it will take
some fiddling to feel like photoshop. -
-
- I want to make a QDockWidget. Is it possible?
You mean you want to include the widgets from other files?
Ys, just include the .h from the other widgets into the Dock one and
then you can create those from code. ( and insert into Dock) -
@mrjj Sorry, but I'm new, could you give me an example?
-
@TETTRA
Example on ?