Forum
Sign Up

QtitanDocking2.3.0+QtitanRibbon5.0.0: Crash when panel is shown/hidden

4 years 11 months ago #1 by Jörn
This code crashes when TestAct is toggled.

:h
#pragma once

#include <QtitanRibbon.h>
#include <QtitanDocking.h>


class GuiTest : public RibbonMainWindow
{
Q_OBJECT

public:
GuiTest(QWidget *parent = Q_NULLPTR);

private:
Ui::GuiTest ui;
DockPanelManager *dockPanelManager;
DockWidgetPanel* dockPanel1;
QAction *TestAct;

public slots:
void panelActionTriggered();

};


:cpp

#include <QtitanRibbon.h>
#include <QtitanDocking.h>

GuiTest::GuiTest(QWidget *parent)
: RibbonMainWindow(parent)
{
QLatin1String m_defaultStyle("windowsvista");
qApp->style()->setObjectName(m_defaultStyle);

ui.setupUi(this);

setWindowTitle("QtitanRibbon + QtitanDocking");

ribbonBar()->setFrameThemeEnabled(true);
ribbonBar()->setTitleBarVisible(true);

QWidget *widget = new QWidget;
dockPanelManager = new DockPanelManager(widget);
dockPanelManager->setDockPanelTransparentWhileDragging(true);
dockPanelManager->setArrowMarkersShown(true);
dockPanelManager->setDockPanelFullContentsWhileDraggingShown(true);
setCentralWidget(widget);

dockPanelManager->centralLayoutPanel();

////// 2 - Creating a ribbon
ribbonBar()->setFrameThemeEnabled();
RibbonPage *page = ribbonBar()->addPage("&Buttons1");

////// 3 - Creating a dockBarManager
DockBarManager* managerBar = new DockBarManager(widget);
DockToolBar* tooBar = managerBar->addToolBar("My Toolbar", Qtitan::DockBarTop);
TestAct = tooBar->addAction("Button");
TestAct->setCheckable(true);
TestAct->setChecked(true);
connect(TestAct, SIGNAL(triggered()), this, SLOT(panelActionTriggered()));

////// 4 - Creating a panelManager
DockWidgetPanel* dockPanel1 = dockPanelManager->addDockPanel("My Panel_1", Qtitan::LeftDockPanelArea);
dockPanel1->setWidget(new QLabel("panel1"));
DockWidgetPanel* dockPanel2 = dockPanelManager->addDockPanel("My Panel_2", Qtitan::RightDockPanelArea);
dockPanel2->setWidget(new QLabel("panel2"));


}

void GuiTest::panelActionTriggered()
{
if (TestAct->isChecked())
dockPanelManager->showDockPanel(dockPanel1);
else
dockPanel1->closePanel();
}

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

More
4 years 11 months ago #2 by Jörn
The Code is wrong.
dockPanel1 is a member of GuiTest but is redefined in GuiTest::GuiTest
////// 4 - Creating a panelManager
DockWidgetPanel *dockPanel1 = dockPanelManager->addDockPanel("My Panel_1", Qtitan::LeftDockPanelArea);
^^^^^^^^^^^^^^^^^^ <- wrong

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

More
1 year 11 months ago #3 by Zeng
panel shown/hidden work well with following codes
if(state == Qt::Checked)
{
if( Qtitan::DockWidgetPanel* panel = qobject_cast<Qtitan::DockWidgetPanel*>(pPane) )
{
panel->showPanel();
}
}
else
{
if( Qtitan::DockWidgetPanel* panel = qobject_cast<Qtitan::DockWidgetPanel*>(pPane) )
{
panel->closePanel();
}
}

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

More
1 year 11 months ago #4 by Zeng
dockPanelManager = new DockPanelManager(widget);
change to this code
dockPanelManager = new Qtitan::DockPanelManager(qobject_cast<QMainWindow*>(parent));
can not work,dockPanel not show in the RibbonMainWindow frame。

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.142 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 )