Forum
Sign Up
× DataGrid for Qt.C++

Make Grid header editable

1 year 8 months ago #7 by Developer Machines
Why you do not want to implement the editor of the header title based on the QWidget which you can embed to the header of the table? You can program absolutely any behavior.

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

More
1 year 8 months ago #8 by Stephanie
Replied by Stephanie on topic Make Grid header editable
Could you please let us know how to achieve following cases while implementing the editor of the header title based on the QWidget which we have to embed in table header?
Case 1) How to get the column header size so that we can embed the QWidget of similar size to the column header.
Case 2) How to remove boundaries from the label which we embed to the header so that it doesn't look like a separate widget inside the header.(Please refer tableHeaderWithLabel.PNG)



Currently, we have tried the following approach to remove the boundaries from the label but boundaries are not gets removed
label->setAutoFillBackground(false);
label->setStyleSheet("background:transparent");
label->setAttribute(Qt::WA_TranslucentBackground);
label->setStyleSheet("border: 0px;");
We have created the custom label so that we can can get the double click event on it.

Case 3)Is there any signal present which gets emitted when we perform resize of a column.
We want to resize the label based on the changes done to a column so that it doesn't look like a separate widget present in the header.
Attachments:

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

More
1 year 8 months ago - 1 year 8 months ago #9 by Developer Machines
You do not need to know the width of the column. When embedding, the grid manages the width of the qwidget and stretches it to the full width of the column automatically.
Could you send your test project to This email address is being protected from spambots. You need JavaScript enabled to view it.? We will study it and give our comments how it can be improved.
Last edit: 1 year 8 months ago by Developer Machines.

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

More
1 year 8 months ago - 1 year 8 months ago #10 by Stephanie
Replied by Stephanie on topic Make Grid header editable
I have updated the RelationModel sample to embed the Qlabel to the ID column.
I have attached the updated sample application in QTITAN_DataGrid.zip folder.(Same I have sent an email to This email address is being protected from spambots. You need JavaScript enabled to view it.)
Please let us know if you need anything else
Last edit: 1 year 8 months ago by Stephanie.

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

More
1 year 7 months ago - 1 year 7 months ago #11 by Developer Machines
>>How to get the column header size so that we can embed the QWidget of similar size to the column header.

Thank you for the demo. For now to control the width of the QWidget please return the right value via sizeHint() method of the widget. For your code:
QSize IXQlabelClickable::sizeHint() const
{
    return QSize(100, QLabel::sizeHint().height());
}

However, in your example, you tried to limit the width through setFixedWidth and you did not succeed. This is a bug in our code, in the upcoming version it will be fixed.

>>How to remove boundaries from the label which we embed to the header so that it doesn't look like a separate widget inside the header.
Unfortunately, it is not possible in current version. We added a new param to GridTableColumnEditor constructor that allows you to set the border thickness.
Last edit: 1 year 7 months ago by Developer Machines.

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 MachinesEduard
Time to create page: 0.144 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 )