[Qt-interest] Submitting changes in a QTableView
Malyushytsky, Alex
alex at wai.com
Fri Jul 10 23:10:35 CEST 2009
>> the Qt integration into Eclipse which I am using does not support
custom widget in the Designer, so I would have to use the external designer or
no designer at all.
Just want to be sure, you mean "Promoting Widgets" does not work?
It is kind of strange. If it is true, I would try to make it work first.
I remember these nasty days with QT3 where this was my main problem.
Regards,
Alex
-----Original Message-----
From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Lars Amsel
Sent: Thursday, July 09, 2009 11:37 PM
To: qt-interest at trolltech.com
Subject: Re: [Qt-interest] Submitting changes in a QTableView
Malyushytsky, Alex wrote:
> I don't see why you would not subclass.
First, I don't like subclassing for such simple tasks, because I end up with a
big bunch of classes like QTableviewWithSubmitMethod. Second (more practical
reason) the Qt integration into Eclipse which I am using does not support
custom widget in the Designer, so I would have to use the external designer or
no designer at all.
> But the key is that these are slots and not just an ordinary functions.
> You can connect them to any signal.
> The fact that they are protected is irrelevant when we are talking about signal/slot implementation.
> You still can connect any signal to any slot, it does not matter if it is protected, private or public.
Oh, I didn't know that, but will keep it in mind. That really solves my problem.
class MainWindow : public QMainWindow {
...
signals:
commitTableData(QWidget* widget);
}
MainWindow::MainWindow(QWidget *parent, Qt::WFlags flags) :
QMainWindow(parent, flags) {
...
connect(
this, SIGNAL(commitTableData(QWidget*)),
ui.table, SLOT(commitData(QWidget*)));
}
void MainWindow::on_actionAnalyse_triggered() {
//first commit dangling edits
QWidget* widget = ui.tableData->focusWidget();
if (widget != NULL) {
emit commitTableData(widget);
}
//continue analysis
}
Still, this looks like a hack to me, but the previous solution (sending
QKeyEvent with return key) was even more a hack.
Thanks
Lars
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest
---------------------------------------------------------------------------------------------------
Weidlinger Associates, Inc. made the following annotations.
"This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you."
"Please consider our environment before printing this email."
More information about the Qt-interest-old
mailing list