Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
4.6.3, 4.8.3, 5.0.0 RC 1
-
windows 7
-
04de24c6449422d29a0d4760375aa94f59222fa3, Revert: dd262dc7f5c02ffaaa965815a9ccc8978efdbabf
Description
I think there is a bug at QTreeWidgetItem.
In this sample project I added a QTreeWidget item with a button and text.
After this I set the following line:
pbtn->setVisible(false);
Here I expected that the button is displayed and only the text below is shown after but it isn't. The button is displayed all the time so the method "setVisible()" has no effect. I attached the sample project.
mainwindow.h:
#include <QMainWindow> #include <QTreeWidget> #include <QTreeWidgetItem> #include <QPushButton> namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: MainWindow(QWidget *parent = 0); ~MainWindow(); protected: void changeEvent(QEvent *e); private: Ui::MainWindow *ui; private slots: void click123(); };
mainwindow.cpp:
#include "mainwindow.h" #include "ui_mainwindow.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); QTreeWidgetItem *widget_item; widget_item = new QTreeWidgetItem(); widget_item->setText(0, "example text"); QPushButton *pbtn; pbtn = new QPushButton(); pbtn->setText("example"); pbtn->setVisible(false); ui->treeWidget->addTopLevelItem(widget_item); ui->treeWidget->setItemWidget(widget_item, 0, pbtn); } MainWindow::~MainWindow() { delete ui; } void MainWindow::changeEvent(QEvent *e) { QMainWindow::changeEvent(e); switch (e->type()) { case QEvent::LanguageChange: ui->retranslateUi(this); break; default: break; } } void MainWindow::click123() { }
Attachments
Issue Links
- is duplicated by
-
QTBUG-92573 QTableWidget: Cellwidget set invisible become visible after column resize
- Closed
- relates to
-
QTBUG-34653 [REG from 5.2 beta1] Qt Designer Widget Box filter does not restore the view properly (Widgets set using QTreeWidget::setItemWidget() disappear when collapsing/expanding rowe or using setRowHidden())
- Closed
Gerrit Reviews
For Gerrit Dashboard: QTBUG-13522 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
63117,1 | Subject: Fix setVisible() of QWidget has no effect at QTreeWidgetItem | stable | qt/qtbase | Status: ABANDONED | -2 | 0 |
63118,1 | Subject: Fix setVisible() of QWidget has no effect at QTreeWidgetItem | stable | qt/qtbase | Status: ABANDONED | -2 | 0 |
63119,1 | Subject: Fix setVisible() of QWidget has no effect at QTreeWidgetItem | stable | qt/qtbase | Status: ABANDONED | -1 | 0 |
64942,1 | Fix setVisible() of QWidget has no effect in QTreeWidgetItem | stable | qt/qtbase | Status: ABANDONED | 0 | 0 |
64945,8 | Fix setVisible() of QWidget has no effect in QTreeWidgetItem | stable | qt/qtbase | Status: MERGED | +2 | 0 |
70709,1 | Revert "Fix setVisible() of QWidget has no effect in QTreeWidgetItem" | stable | qt/qtbase | Status: MERGED | +2 | 0 |