Results 1 to 6 of 6

Thread: QtTreePropertyBrowser enabled but not editable

  1. #1
    Join Date
    Feb 2012
    Location
    Warsaw, Poland
    Posts
    37
    Thanks
    3
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default QtTreePropertyBrowser enabled but not editable

    I have the QtTreePropertyBrowser whose items mustn't be editable but user wants to be able to scroll and expand root items. Is it possible to reach this? Method setEnabled isn't the solution because it freezes the whole widget.

  2. #2
    Join Date
    Feb 2012
    Location
    Warsaw, Poland
    Posts
    37
    Thanks
    3
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: QtTreePropertyBrowser enabled but not editable

    Hi guys, what do you think about my solution?

    Qt Code:
    1. void Widget::setBrowserEditable(bool editable)
    2. {
    3. QList<QWidget *> widgets = m_browser->findChildren<QWidget *>();
    4. foreach(QWidget *wgt, widgets)
    5. {
    6. if ( wgt->inherits("QScrollBar") || wgt->inherits("QtPropertyEditorView") )
    7. {
    8. continue;
    9. }
    10.  
    11. wgt->setEnabled(editable);
    12. }
    13. }
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,364
    Thanks
    3
    Thanked 5,013 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QtTreePropertyBrowser enabled but not editable

    Can't you simply make the properties not editable?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  4. #4
    Join Date
    Feb 2012
    Location
    Warsaw, Poland
    Posts
    37
    Thanks
    3
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: QtTreePropertyBrowser enabled but not editable

    Unfortunately some of displayed properties are read only so I would have to remember which properties were not editable.

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,364
    Thanks
    3
    Thanked 5,013 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QtTreePropertyBrowser enabled but not editable

    So do that.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. The following user says thank you to wysota for this useful post:

    west (8th October 2014)

  7. #6
    Join Date
    Apr 2010
    Posts
    15
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QtTreePropertyBrowser enabled but not editable

    another way to make

    Qt Code:
    1. void MainWindow::setPropTreeElemReadOnly(bool mode) {
    2. foreach(QtProperty *property, propertyTree->properties()) {
    3. property->setEnabled(mode);
    4. qDebug()<<property->propertyName();
    5. if (property->propertyName() == "StateEnable") {
    6. property->setEnabled(true);
    7. }
    8. }
    9. }
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Replies: 1
    Last Post: 20th January 2014, 00:29
  2. Navigate around the QtTreePropertyBrowser elements
    By qt_developer in forum Newbie
    Replies: 4
    Last Post: 26th April 2013, 15:11
  3. Incorrect QtProperty Order on QtTreePropertyBrowser
    By yaseminyilmaz in forum Qt Programming
    Replies: 1
    Last Post: 23rd March 2012, 23:19
  4. QtTreePropertyBrowser Not Obeying Stylesheet
    By stefanadelbert in forum Qt Programming
    Replies: 0
    Last Post: 12th August 2010, 02:14
  5. QtTreePropertyBrowser and tooltip
    By jobrandt in forum Qt Programming
    Replies: 1
    Last Post: 5th October 2009, 10:43

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.