Q table widget problem, Urgent!!!!!!
-
Maybe the workaround mentioned in QTBUG-7483 can help.
-
@VInay123 said:
i have created a 3 table widget using designer, and their respective items has been declered in the header files.
What items are declared in the header, how and why? Please show how you populate the widget(s) and other relevant pieces of the code.
I cannot use tableview.
You are already using a table view.
QTableWidget
derives fromQTableView
.Also what version of Qt are you using?
-
@kshegunov
From the designer i get a header file where the Qtablewidget is declared.I have a separate cpp and header file for development process, this header file has the inclusion of the header file obtained from designer.
In the development header file i declare a pointer of Qtablewidget items[][];
and in cpp the constructor i populate the items so a table is created .
and in my funtion i fill the table
I use qt 4.7.8
-
-
@Wieland when we click the column names of the table widget i get a small arrow inside and sorting happens one click ascending and one click descending. How do i disable it?? i tried setsortingenabled(false) but its still sorting
-
@VInay123 I can only test it with Qt 5.6. With this, in the designer there is a property
sortingEnabled
. When this isn't selected I don't get the small arrow and clicking the header does not cause any sorting. -
@VInay123 Also with Qt 5.6 ascending and descending sorting works as expected. Can't you update to a more recent Qt version?
-
@Wieland I havent check that box of sort enabled in the property box, but it is in bold compared to other properties. And because i work with a other software called ADTF , higher versions are not compatible :(
-
@Wieland
I have a question, i think i could use the signal when i click header.Actually with designer i have created rows and column names. now i would like to use the signal when i click the column.
right now i use QObject::connect(ui.tablewidget->verticalheader(), SIGNAL(sectionPressed(int)), this, SLOT(function(int))).
But i am never receiving a signal. I tried using sectionClicked(int) or sectionDoubleClicked(int). which is an approporiate one to know whther a user has clicked the header or column name ones or twice? -
@VInay123 Hi! This works for me (Qt 5.6):
connect( ui->tableWidget->verticalHeader(), SIGNAL(sectionClicked(int)), this, SLOT(sayHi()) );