Results 1 to 3 of 3

Thread: Cancel last user ever

  1. #1
    Join Date
    Nov 2008
    Posts
    17
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Cancel last user ever

    Hello all,

    How to cancel last event?

    I have a tree, some of the branches can be renamed, but some names are forbidden. So I catch itemRenamed signal from the tree and check item name. But how I can undone last user operation (rename) if if value is invalid? itemRenamed() function already has modified item name.

    Is there any signal than can be caught before applying new item name?

    I'm using Qt4.4 and tree is a Q3ListView object instance.

  2. #2
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Cancel last user ever

    you have two possibilities here:
    1) prevent renaming:
    Qt4: QListWidgetItem::setFlags() Q3ListViewItem::setRenameEnabled()
    2) allow the user to do something, and then say "no you don't" afterwards...
    I don't like that approach
    Then, you could integrate the model with QUndoStack (interesting to do, but overkill for you).

    HTH

  3. #3
    Join Date
    Nov 2008
    Posts
    17
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Cancel last user ever

    Quote Originally Posted by caduel View Post
    But user should be able to rename tree branches.

    Quote Originally Posted by caduel View Post
    2) allow the user to do something, and then say "no you don't" afterwards...
    I don't like that approach
    itemRenamed() signal passes renamed item, so I can only say "that was wrong, please turn it back".

    Any way, is it possible to attach a validator to rename field? I assume, rename field is QLineEdit object.

    Quote Originally Posted by caduel View Post
    Then, you could integrate the model with QUndoStack (interesting to do, but overkill for you).

Similar Threads

  1. Logging Qt User Actions
    By Frank J. Lhota in forum Qt Programming
    Replies: 14
    Last Post: 30th May 2014, 21:36
  2. Replies: 2
    Last Post: 27th November 2008, 10:16
  3. systemwide user profiles
    By luf in forum Qt Programming
    Replies: 0
    Last Post: 6th August 2008, 14:12
  4. Replies: 1
    Last Post: 24th June 2006, 11:10
  5. linking user space and kernel space programs with qmake
    By zielchri in forum Qt Programming
    Replies: 9
    Last Post: 8th March 2006, 23:11

Tags for this Thread

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.