gpt4 book ai didi

Qt - QTreeView WordWrap 不起作用

转载 作者:行者123 更新时间:2023-12-01 06:46:38 25 4
gpt4 key购买 nike

我一直在阅读一些关于 WordWrap 不适用于 QTreeView 的论坛(如屏幕外显示的文本),但我找不到任何解决此问题的“黑客”。 bookTreeView 被封装在另一个小部件中,这可能是问题所在……或者它只是不受支持?

    bookTreeView->setModel(standardModel);
bookTreeView->setEditTriggers(QAbstractItemView::NoEditTriggers);
bookTreeView->setWordWrap(true);
bookTreeView->sizeHint();
bookTreeView->setTextElideMode(Qt::ElideNone);
bookTreeView->setExpandsOnDoubleClick(true);
bookTreeView->setUniformRowHeights(true);
bookTreeView->setHeaderHidden(true);
bookTreeView->setStyleSheet("QTreeView { font-size: 27px; show-decoration-selected: 0; } QTreeView::branch:has-siblings:!adjoins-item { border-image: none; } QTreeView::branch:has-siblings:adjoins-item { border-image: none; } QTreeView::branch:!has-children:!has-siblings:adjoins-item { border-image: none;} QTreeView::branch:has-children:!has-siblings:closed, QTreeView::branch:closed:has-children:has-siblings { border-image: none; image: url(':images/images/right_arrow.png'); } QTreeView::branch:open:has-children:!has-siblings, QTreeView::branch:open:has-children:has-siblings { border-image: none; image: url(':images/images/down_arrow.png'); } ");

QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(someWidget);
layout->addWidget(bookTreeView);

QWidget *page = new QWidget;
page->setLayout(layout);

return page;

最佳答案

我只知道 hack - 它在 Tree Item 中是 QLable。

关于Qt - QTreeView WordWrap 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4371829/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com