want to hide the editor2 when we cliclking on treewidgetitem on left handside



  • I want to implement the windows 10 Outlook Mail feature which works in toggle mode

    when i first click qtreewidget item it shows be QTextEdit and when I again click the same qtreewidgetitem it hides the right hand side Qtextedit

    Can someone suggest me how to do that

    int main(int argc, char *argv[])
    {
        QApplication app(argc, argv);
    
        QTextEdit *editor1 = new QTreeWidget;
        QTextEdit *editor2 = new QTextEdit;
        
    
        QSplitter splitter(Qt::Horizontal);
        splitter.addWidget(editor1);
        splitter.addWidget(editor2);
        
        ...
        splitter.show();
        return app.exec();
    }
    




  • @Qt-Enthusiast said in want to hide the editor2 when we cliclking on treewidgetitem on left handside:

    int main(int argc, char *argv[])
    {
    QApplication app(argc, argv);

    QTextEdit *editor1 = new QTreeWidget;
    QTextEdit *editor2 = new QTextEdit;
    
    
    QSplitter splitter(Qt::Horizontal);
    splitter.addWidget(editor1);
    splitter.addWidget(editor2);
    
    ...
    splitter.show();
    return app.exec();
    

    }

    int main(int argc, char *argv[])
    {
    QApplication app(argc, argv);

    QTreeWidget *editor1 = new QTreeWidget;
    QTextEdit *editor2 = new QTextEdit;
    
    
    QSplitter splitter(Qt::Horizontal);
    splitter.addWidget(editor1);
    splitter.addWidget(editor2);
    
    ...
    splitter.show();
    return app.exec();
    

    }
    reply quote 0



  • QObject::connect(editor1,&QAbstractItemView::clicked,[=](const QModelIndex& clickedIdx)->void{/*Do Something With editor2*/});


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.