Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to change the header of a QHelpContentWidget
Forum Updated to NodeBB v4.3 + New Features

How to change the header of a QHelpContentWidget

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 317 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    Hello,

    I'm using the QHelpEngine within my software and have created a dialog that sports the QHelpContentWidget on the left to display the tree view of the help and a QTextBrowser on the right to display the actual help contents. Since QHelpContentWidget inherits QTreeView, I figured it should be possible to show the header and set the header data to whatever I want it to be, in my case, I'd like it to be "Contents".

    I make sure that the headerView is visible:

    pContentWidget->setHeaderHidden(false);
    

    Then I am trying two options: 1 is to access the model through the content widget:

    QHelpContentWidget* pContentWidget = pHelpEngine->contentWidget();
    pContentWidget->header()->model()->setHeaderData(0, Qt::Horizontal, QString(tr("Contents")), Qt::DisplayRole);
    qDebug() << pContentWidget->model()->headerData(0, Qt::Horizontal);
    

    and 2 accessing the model from the separate access function in the QHelpEngine:

    QHelpContentModel* pContentModel = pHelpEngine->contentModel();
    pContentModel()->setHeaderData(0, Qt::Horizontal, QString(tr("Contents")), Qt::DisplayRole);
    qDebug() << pContentModel->headerData(0, Qt::Horizontal);
    

    In both cases, setHeaderData returns 'false' and the header is not updated but displays what seems to be the default value '1'.

    Any ideas, what I am missing here?

    Thanks,
    Tobias

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved