Hi,
I try to take window from QWorkspace. But it doesn't work:
Qt Code:
m_tablePanel = (TabelPanel *)(workspace->windowList()).at(0);To copy to clipboard, switch view to plain text mode
Thank you!
Hi,
I try to take window from QWorkspace. But it doesn't work:
Qt Code:
m_tablePanel = (TabelPanel *)(workspace->windowList()).at(0);To copy to clipboard, switch view to plain text mode
Thank you!
8Observer8 (22nd August 2013)
I cannot update my Plot.
42.jpg
I'm a little ashamed for my code. But this is my first MDI program.
There is a little code:
Qt Code:
m_tablePanel = (TabelPanel *)(workspace->windowList()).at(0); m_plotPanel = (PlotPanel *)(workspace->windowList()).at(1); connect(m_tablePanel, SIGNAL(itemChanged(QStandardItem *)), this, SLOT(updatePanel(QStandardItem*)));To copy to clipboard, switch view to plain text mode
Qt Code:
{ m_plotPanel->updatePanel(model); }To copy to clipboard, switch view to plain text mode
Maybe you can't update your plot but it doesn't mean the method doesn't work. Especially that you have an ugly C cast instead of qobject_cast or something similar. How do you know that the first item in the list is an instance of TablePanel and the second one is an instance of PlotPanel?
8Observer8 (22nd August 2013)
I want to take instance of TablePanel and PlotPanel from workspace. I don't know how to do it.
It's doesn't work:
Qt Code:
m_tablePanel = qobject_cast<TabelPanel *>((workspace->windowList()).at(0)); m_plotPanel = qobject_cast<PlotPanel *>((workspace->windowList()).at(1));To copy to clipboard, switch view to plain text mode
I added the Table then the Plot.
Qt Code:
workspace->addWindow(tablePanel); workspace->addWindow(plotPanel);To copy to clipboard, switch view to plain text mode
Slot of MainWindow updatePanel() doesn't work.
Qt Code:
connect(m_tablePanel, SIGNAL(itemChanged(QStandardItem *)), this, SLOT(updatePanel(QStandardItem*)));To copy to clipboard, switch view to plain text mode
Last edited by 8Observer8; 22nd August 2013 at 13:43.
8Observer8 (22nd August 2013)
I set a breakpoint in updatePanel() SLOT
Qt Code:
{ m_plotPanel->updatePanel(model); }To copy to clipboard, switch view to plain text mode
8Observer8 (22nd August 2013)
Apparently your signal-slot connection is invalid.
TablePanel class is unlikely to have a signal itemChanged() carrying a QStandardItem pointer unless you added such signal to the class yourself.
8Observer8 (22nd August 2013)
Thanks! Now the breakpoint works.
Qt Code:
To copy to clipboard, switch view to plain text mode
But the Plot is not redrawn.
plotpanel.cpp
Qt Code:
#include "plotpanel.h" #include <QHBoxLayout> #include <QDebug> #include <qwt_plot_curve.h> #include <qwt_symbol.h> { mainLayout->addWidget(plot); this->setLayout(mainLayout); } { curve->setTitle(tr("Points")); curve->setSymbol(symbol); QPolygonF points; double x, y; for (int row = 0; row < model->rowCount(); row++) { x = model->data(index).toDouble(); index = model->index(row, 1); y = model->data(index).toDouble(); } curve->setSamples(points); curve->attach(plot); // this->update(); }To copy to clipboard, switch view to plain text mode
Bookmarks