Results 1 to 6 of 6

Thread: How to change default windows class name?

  1. #1
    Join Date
    Mar 2010
    Posts
    68
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Default How to change default windows class name?

    QT creates all windows only with one windows class name is QWidget. Can I change this to random name?

  2. #2
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: How to change default windows class name?

    I don't think that is possible, and i don't find a reason to do that, so why do you need to change the class name?

    But what you can do is: derive from QWidget and give the class any name you want.

  3. #3
    Join Date
    Sep 2008
    Location
    Munich
    Posts
    32
    Thanked 8 Times in 6 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to change default windows class name?

    Not sure if I understand you right. Here my 10cents ;-)

    For window: QWidget::setWindowTitle(), changes the window title
    For general widgets: QObject::setObjectName(), changes to object name (good for debugging)

  4. #4
    Join Date
    Mar 2010
    Posts
    68
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Default Re: How to change default windows class name?

    You haven’t understood my aim. I want to hide windows class name for spy programs. Somebody know this?

  5. #5
    Join Date
    Sep 2008
    Location
    Munich
    Posts
    32
    Thanked 8 Times in 6 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to change default windows class name?

    Can you proide an example how someone spys on your program and read the QWidget (window) class names?

  6. #6
    Join Date
    Dec 2011
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to change default windows class name?

    I'm actually curious about answering this question myself... I think the problem so far is that the term "class name" is ambiguous when it comes to GUI programming. The term as used by the original poster doesn't refer to the classic OOP concept of a class, but rather to a string attached to each window in many (all?) modern windowing systems. For instance, under X11, you can determine a window's class by querying its WM_CLASS property, using a program such as xprop or xwininfo:

    # xprop WM_CLASS
    WM_CLASS(STRING) = "urxvt", "URxvt"


    On MS Windows, there are programs such as WinSpy++ which allow you to view a window's class name. (I believe there's also a more basic program called WinSpy which comes with Visual Studio, which performs the same task)

    In my case, I'd like to change the class name of all message boxes in my application so that I can match them in my window manager's settings, and force them to a higher layer than another program. (I'm developing an embedded Linux-based distro for my work, so we have pretty tight control over the environment)

    Edit: A small clarification: In my application, which is using Python, PySide, and Qt 4, the WM_CLASS attribute is always set to "App.py", which is the name of the main file of my application, and the value of argv[0]. I'd like to be able to change that for individual windows in my app.

Similar Threads

  1. How to change default clipping?
    By swbluto in forum Qt Programming
    Replies: 2
    Last Post: 29th October 2009, 18:35
  2. How to change default manifest file?
    By piotr.dobrogost in forum General Programming
    Replies: 1
    Last Post: 22nd July 2009, 08:53
  3. default on class' public data
    By baray98 in forum General Programming
    Replies: 2
    Last Post: 29th July 2008, 02:04
  4. default parameters in constructor class
    By mickey in forum General Programming
    Replies: 4
    Last Post: 23rd February 2008, 18:44
  5. change txt file type default icon
    By mismael85 in forum Qt Programming
    Replies: 8
    Last Post: 20th February 2008, 22:22

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.