[Qt-interest] Vertical tabs with icons instead text, tables with buttons, animated pictures on buttons
Malyushytsky, Alex
alex at wai.com
Tue Mar 29 21:48:45 CEST 2011
There are a few ways to do it.
The simplest might be:
>> but how can I connect slot to click signal?
Connect button clicked signal to the custom slot.
QPushButton * pushbutton = new QPushButton("text")
I can insert button with ui->tableWidget->setCellWidget(0, 0, pushbutton);
>> what button in what row was pressed?
In the custom slot search for the cellWidget and find column and row which are equal to sender()
or use QSignalMapper.
In addition you completely may avoid QPushButton, if you just paint push button instead of setting cellWidget.
This can be done using QItemDelegate to draw pushbutton in cell.
This might be a bit more work, cause you will have to animate button when it is clicked.
Alex
-----Original Message-----
From: qt-interest-bounces+alex=wai.com at qt.nokia.com [mailto:qt-interest-bounces+alex=wai.com at qt.nokia.com] On Behalf Of ??????? ???????
Sent: Tuesday, March 29, 2011 11:48 AM
To: Adam Light
Cc: qt-interest at qt.nokia.com
Subject: Re: [Qt-interest] Vertical tabs with icons instead text, tables with buttons, animated pictures on buttons
I can insert button with ui->tableWidget->setCellWidget(0, 0, (QWidget
*) new QPushButton("text"));
but how can I connect slot to click signal? And how will slot know
what button in what row was pressed?
2011/3/29 Николай Шатохин <n.shatokhin at gmail.com>:
> How to insert items to QTableWidget? I don't now how many items in XML
> document, but I need insert all to table.
> Table create numbers of rows. How to off it? How to insert button to
> the table's cell?
>
> 2011/3/26 Adam Light <aclight at gmail.com>:
>> On Fri, Mar 25, 2011 at 4:19 PM, Nicholas Shatokhin
>> <n.shatokhin at gmail.com> wrote:
>>> But problems with tabs. I can't set layouts on its. Every time changes
>>> layout of centralWindet, not Tab. What's wrong? I add layout to Tab
>>> manually, but how can I set autoresizing of it?
>>
>> I have had this problem with QStackedWidget and QTabWidget widgets for
>> a while also, but I recently figured out how to set the layout for
>> each tab/page using Qt Designer 2.1. You first need to select the
>> proper tab/page from the list of objects on the right side of
>> designer. Then you must click on the parent widget in that list (the
>> QTabWidget or QStackedWidget). Then you can set the layout on the
>> tab/page by clicking one of the different layout buttons in the
>> toolbar. Note that you only select one item at a time--you don't want
>> to select *both* the tab/page and it's parent
>> QTabWidget/QStackedWidget.
>>
>> I don't think this is very intuitive, but it was nice to finally
>> figure out how to make it work.
>>
>> Adam
>>
>
_______________________________________________
Qt-interest mailing list
Qt-interest at qt.nokia.com
http://lists.qt.nokia.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