Results 1 to 7 of 7

Thread: widgets on bottom

  1. #1
    Join Date
    Jan 2007
    Posts
    177
    Thanks
    8
    Thanked 10 Times in 9 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default widgets on bottom

    how can i set widgets on the bottom on desktop?
    not on top, under all other windows. on linux

    and if it somebody knows, how can i get the desktop wallet?

    or how can i grab a virtual Desktop, which only has the desktop wallet?
    Last edited by kernel_panic; 18th August 2007 at 21:36.

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: widgets on bottom

    Quote Originally Posted by kernel_panic View Post
    how can i set widgets on the bottom on desktop?
    not on top, under all other windows. on linux
    Try _NET_WM_STATE_BELOW.
    J-P Nurmi

  3. #3
    Join Date
    Jan 2007
    Posts
    177
    Thanks
    8
    Thanked 10 Times in 9 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: widgets on bottom

    how can i use this with Qt? with python.

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: widgets on bottom

    I can't say about Python but in C++ you could do something like this:
    Qt Code:
    1. #include <QApplication>
    2. #include <QWidget>
    3. #include <QX11Info>
    4. #include <X11/Xatom.h>
    5. #include <X11/Xlib.h>
    6.  
    7. int main(int argc, char* argv[])
    8. {
    9. QApplication a(argc, argv);
    10. QWidget widget;
    11. widget.setWindowTitle("Bottom");
    12. widget.show();
    13.  
    14. Display* display = QX11Info::display();
    15. Atom state = XInternAtom(display, "_NET_WM_STATE", True);
    16. Atom below = XInternAtom(display, "_NET_WM_STATE_BELOW", True);
    17.  
    18. XEvent event;
    19. event.xclient.type = ClientMessage;
    20. event.xclient.message_type = state;
    21. event.xclient.display = display;
    22. event.xclient.window = widget.winId();
    23. event.xclient.format = 32;
    24. event.xclient.data.l[0] = 1; // turn on
    25. event.xclient.data.l[1] = below;
    26. event.xclient.data.l[2] = 0l;
    27. event.xclient.data.l[3] = 0l;
    28. event.xclient.data.l[4] = 0l;
    29. XSendEvent(display, QX11Info::appRootWindow(), False,
    30. (SubstructureRedirectMask | SubstructureNotifyMask), &event);
    31.  
    32. return a.exec();
    33. }
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

  5. #5
    Join Date
    Mar 2006
    Location
    Argentina - CABA
    Posts
    66
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Platforms
    Unix/X11

    Default Re: widgets on bottom

    Hi!

    Could someone translate this to PyQt?

    Thanks in advance.


    Cheers.
    Gustavo A. DÃ*az
    artistic.gdnet.com.ar

  6. #6
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: widgets on bottom

    I'm no python-xlib export but here's something that should get you pretty close
    Qt Code:
    1. import sys
    2. from PyQt4 import QtGui
    3. from Xlib import X, display, protocol
    4.  
    5. app = QtGui.QApplication(sys.argv)
    6. widget = QtGui.QWidget()
    7. widget.setWindowTitle("Bottom")
    8. widget.show()
    9.  
    10. disp = display.Display()
    11. state = disp.intern_atom("_NET_WM_STATE")
    12. below = disp.intern_atom("_NET_WM_STATE_BELOW")
    13. data = [1, below, 0, 0, 0]
    14. event = protocol.event.ClientMessage(
    15. window = widget.winId(),
    16. client_type = state,
    17. data = (32, data))
    18. disp.send_event(disp.screen().root, event,
    19. (X.SubstructureRedirectMask | X.SubstructureNotifyMask))
    20.  
    21. sys.exit(app.exec_())
    To copy to clipboard, switch view to plain text mode 
    Last edited by jpn; 15th September 2007 at 10:30. Reason: spelling error
    J-P Nurmi

  7. The following user says thank you to jpn for this useful post:

    kernel_panic (4th October 2007)

  8. #7
    Join Date
    Mar 2006
    Location
    Argentina - CABA
    Posts
    66
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Platforms
    Unix/X11

    Default Re: widgets on bottom

    Hi!!

    First thanks to translate it to Python language.
    Second, this code does absolutely nothing, but if i change the import Xlib line as:

    from Xlib import X
    from Xlib.protocol import display
    from Xlib.protocol.request import *

    I get this error:

    state = display.intern_atom("_NET_WM_STATE")
    AttributeError: Display instance has no attribute 'intern_atom'

    My code:

    if __name__ == "__main__":
    app = QtGui.QApplication(sys.argv)
    app.setQuitOnLastWindowClosed(False)
    mainApp = OpenCoffee_Client()
    mainApp.show()

    ## Colocamos la aplicación por debajo de las demás ventanas y eliminamos la entrada en el taskbar.
    ## Para esto es necesario usar las caracterÃ*sticas del servidor X, importando la librerÃ*a xlib de python.
    ## TODO: seguir trabajando en esto
    display = display.Display(":0")
    state = display.intern_atom("_NET_WM_STATE")
    placeBelow = display.intern_atom("_NET_WM_STATE_BELOW")
    hideTaskbar = display.intern_atom("_NET_WM_STATE_SKIP_TASKBAR")
    data = [1, placeBelow, hideTaskbar, 0, 0]
    event = protocol.event.ClientMessage(window = mainApp.winId(), client_type = state, data = (32, data))
    disp.send_event(disp.screen().root, event, (X.SubstructureRedirectMask | X.SubstructureNotifyMask))

    sys.exit(app.exec_())
    Just in case, the full code is in here: http://opencoffee.lnxteam.org/trac/b...ncoffee-client
    Gustavo A. DÃ*az
    artistic.gdnet.com.ar

Similar Threads

  1. Qt3 - Multiple transparent widgets
    By bythesea in forum Qt Programming
    Replies: 4
    Last Post: 11th September 2009, 11:24
  2. New widgets after application begins
    By petty in forum Newbie
    Replies: 5
    Last Post: 8th May 2007, 12:10
  3. Performance in hiding/showing widgets
    By Paalrammer in forum Newbie
    Replies: 12
    Last Post: 14th February 2007, 18:57
  4. Replies: 11
    Last Post: 7th July 2006, 13:09
  5. Creating Widgets
    By hylke in forum Qt Programming
    Replies: 2
    Last Post: 5th February 2006, 08:37

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.