Forum
Sign Up

QMdiArea

4 years 5 months ago #1 by jia
QMdiArea was created by jia
How can QtitanRibbon work together with QMidArea?
My code like this , but the hold can't fill client window.
holder = new RibbonWorkspace(this);
    holder->setAttribute(Qt::WA_CanHostQMdiSubWindowTitleBar);

    m_mdiArea = new QMdiArea(holder);

    m_mdiArea->setLineWidth(3);
    m_mdiArea->setFrameShape(QFrame::Panel);
    m_mdiArea->setFrameShadow(QFrame::Sunken);
    m_mdiArea->setViewMode(QMdiArea::TabbedView);
    setCentralWidget(holder);
    m_mdiArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
    m_mdiArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);

    m_mdiArea->addSubWindow(new QTableWidget());
    m_mdiArea->addSubWindow(new QTableWidget());
    m_mdiArea->addSubWindow(new QTableWidget());
Attachments:

Please Log in or Create an account to join the conversation.

More
4 years 5 months ago #2 by Eduard
Replied by Eduard on topic QMdiArea
Hello!
You can’t fill full client window with this code. RibbonWorkspace is a common widget not having an inner layout, so it doesn’t control its children geometry. Class RibbonWorkspace was created to support qtitan styles, i.e. to fill background with the appropriate style. You can see the way we use it in our demo examples. In order to get desired result, there’s need to modify your code as in example below:
RibbonWorkspace* holder = new RibbonWorkspace(this);
holder->setAttribute(Qt::WA_CanHostQMdiSubWindowTitleBar);
QLayout* layout = new QHBoxLayout(holder);
layout->setSpacing(0);
layout->setMargin(0);
QMdiArea* m_mdiArea = new QMdiArea(holder);
layout->addWidget(m_mdiArea);

m_mdiArea->setLineWidth(3);
m_mdiArea->setFrameShape(QFrame::Panel);
m_mdiArea->setFrameShadow(QFrame::Sunken);
m_mdiArea->setViewMode(QMdiArea::TabbedView);
setCentralWidget(holder);
m_mdiArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
m_mdiArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);

m_mdiArea->addSubWindow(new QTableWidget());
m_mdiArea->addSubWindow(new QTableWidget());
m_mdiArea->addSubWindow(new QTableWidget());

or to reload class RibbonWorkspace->MyRibbonWorkspace and use virtual function MyRibbonWorkspace::resizeEven. You can set QMdiArea sizes in it on your own.

P.S. If we properly understood why you used RibbonWorkspace, then please pay attention to our example Ribbon_MDIApplication where we fill out background in QMdiArea. May be you’ll need that

Please Log in or Create an account to join the conversation.

  • Eduard
  • Eduard's Avatar
4 years 5 months ago #3 by jia
Replied by jia on topic QMdiArea
Thank you very much.

Please Log in or Create an account to join the conversation.

More
  • Not Allowed: to create new topic.
  • Not Allowed: to reply.
  • Not Allowed: to edit your message.
Moderators: Developer Machines
Time to create page: 0.127 seconds

Developer Newsletter

Join our Developer Machines newsletter to get informed on all the latest releases of the commercial components for Qt.C++, Delphi FireMonkey, updates and general knowledges.

Quick Support

Should you need any additional information about our products or licensing, please contact us at the following email addresses:

  • This email address is being protected from spambots. You need JavaScript enabled to view it.

  • This email address is being protected from spambots. You need JavaScript enabled to view it.

Get in Touch

If you would like to purchase our products or services, but don’t know how to do it the right way, please feel free to contact us:

  • This email address is being protected from spambots. You need JavaScript enabled to view it.( any questions related to our products or services )
  • This email address is being protected from spambots. You need JavaScript enabled to view it.( questions related to licensing )