0

What the best way to implement dragging widget off from my custom stacked widget?

QVBoxLayout* vBox = new QVBoxLayout();
QHBoxLayout* topBox = new QHBoxLayout();
QLabel* m_caption=new QLabel("Caption");
topBox->addWidget(m_caption);
vBox->addLayout(topBox, 0);
m_stacked_layout = new QStackedLayout();
QLabel* m_stubWidget = new QLabel("No widget in stack!!!");
m_stacked_layout->addWidget(m_stubWidget);
vBox->addLayout(m_stacked_layout, 1);
Juriy
  • 63
  • 1
  • 7
  • How should it look? What do you see now? – ilotXXI Aug 01 '16 at 15:14
  • Thanks for reply! 1) It had to be like n chromium browser pages: I can drag any page by the page title and move to another instance or make page standalone. 2) Now it's just a widget with qstacked layout and Qlabel under the widget. – Juriy Aug 02 '16 at 12:17
  • I want to drag off widgets from `QStackedLayout`. Is there some good way then creating new instance of `QWidget` and specify it as I would move it by the header? – Juriy Aug 02 '16 at 12:19
  • 1. Have you looked at `QDockWidget`? Is it good enough? Otherwise you can consider it's sources as example. 2. You can use the same widget. Just set window flags that allow you to drag it over the parent widget and, maybe, remove from the layout. – ilotXXI Aug 02 '16 at 15:31
  • Yes, I looked at `QDockWidget`, but it was not the choice for because there is fixed dock areas in `QMainWidget` and I've not seen information about how to customize areas to be look like stacked widget. Is `QDockWidget` can be customized to satisfy my needs ? I mean stackedness of dock widgets? I'll check it, thanks for advance – Juriy Aug 03 '16 at 14:13
  • `QDockWidget` can be tabified (one dock above others + tabs to choose them). Launch Qt Main Window demo from Examples And Demos and play with it. – ilotXXI Aug 03 '16 at 14:28

0 Answers0