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. [Solved] Disable QStringListModel
Forum Updated to NodeBB v4.3 + New Features

[Solved] Disable QStringListModel

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 2.3k Views 1 Watching
  • 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.
  • B Offline
    B Offline
    BrawnyLad
    wrote on 27 Aug 2012, 20:05 last edited by
    #1

    Hello gang: I am able to present a list in a view. It is editable, and has a sliding "elevator" to adjust the view. I want to disable the editable characteristic, without disabling the elevator.

    @
    QAbstractItemModel *model = new QStringListModel(textList);
    QListView *view = new QListView;
    QVBoxLayout *layout = new QVBoxLayout;
    view->setModel(model);
    layout->addWidget(view);
    window->setLayout(layout);
    window->setFixedWidth(875);
    window->setFixedHeight(800);
    window->setAttribute(Qt::WA_DeleteOnClose);
    window->show();
    @

    I tried view->setDisabled(1), and that disabled editing, but also disabled the elevator.

    Thank you.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      Sam
      wrote on 28 Aug 2012, 04:53 last edited by
      #2

      Hi,
      In order to make the view as non editable you can try:

      @view->setEditTriggers(QAbstractItemView::NoEditTriggers);@

      you can have a look at "QAbstractItemView Class Reference":http://qt-project.org/doc/qt-4.8/qabstractitemview.html#editTriggers-prop and "EditTrigger":http://qt-project.org/doc/qt-4.8/qabstractitemview.html#EditTrigger-enum

      1 Reply Last reply
      0
      • B Offline
        B Offline
        BrawnyLad
        wrote on 28 Aug 2012, 17:21 last edited by
        #3

        Thank you Sam -- that is perfect!

        1 Reply Last reply
        0
        • S Offline
          S Offline
          Sam
          wrote on 28 Aug 2012, 19:14 last edited by
          #4

          You are most welcome my friend :)

          1 Reply Last reply
          0

          1/4

          27 Aug 2012, 20:05

          • Login

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