Results 1 to 4 of 4

Thread: Bypass MessageBox QFileSystemModel

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2013
    Posts
    321
    Thanks
    9
    Thanked 8 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Bypass MessageBox QFileSystemModel

    Hi all,
    Is it possible to bypass the QMessageBox that QFileSystemModel do when a rename can not be done ?
    The probleme is the message is not good because the message is always the same, if a file has same name he doesn't say it.
    The real problem is not really the message but it's impossible to know if rename failed.
    I would log an error message when the rename failed.
    Thanks for the help
    Last edited by Alundra; 7th June 2014 at 22:54.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Bypass MessageBox QFileSystemModel

    The "Invalid filename" message box tells you the file name that is a problem.

    If you just want to rename a file why not use QDir::rename() directly and check the return value? You could even check if the target file name exists before you try to rename to it.

  3. #3
    Join Date
    May 2013
    Posts
    321
    Thanks
    9
    Thanked 8 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Bypass MessageBox QFileSystemModel

    I don't do anything, the QFileSystemModel does this message box by himself, that's why my question.
    I just have the model no read-only to allow edit, and this message is managed by the model.

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Bypass MessageBox QFileSystemModel

    Which is why ChrisW67 suggested doing the renaming in code you control.

    For example with a custom delegate to handle the editing differently, or a model derived from QFileSystemModel and a setData() override that handles it differently or a proxy model inbetween the unchanged model and the view with a setData() that handles the rename.

    Cheers,
    _

Similar Threads

  1. how to bypass repainting a containing widget?
    By RolandHughes in forum Qt Programming
    Replies: 3
    Last Post: 31st January 2014, 10:42
  2. Getting the Icon of a MessageBox
    By thru in forum Qt Programming
    Replies: 2
    Last Post: 29th December 2010, 17:19
  3. Extending MessageBox
    By thru in forum Qt Programming
    Replies: 7
    Last Post: 17th December 2010, 16:31
  4. use GNU make entirely and bypass qmake?
    By kevinm in forum Qt Programming
    Replies: 1
    Last Post: 5th September 2008, 22:40
  5. QSA 1.2.1 && MessageBox
    By xk in forum Newbie
    Replies: 0
    Last Post: 20th April 2006, 17:30

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
  •  
Qt is a trademark of The Qt Company.