Results 1 to 4 of 4

Thread: QToolBar setstylesheet Problem

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QToolBar setstylesheet Problem

    i solved the toolbar problem like this:
    Qt Code:
    1. QToolBar#myToolBar > QWidget {
    2. background: blue;
    3. }
    To copy to clipboard, switch view to plain text mode 
    if i do this:
    Qt Code:
    1. QToolBar#myToolBar {
    2. background: blue;
    3. }
    To copy to clipboard, switch view to plain text mode 
    only the action buttons get colored.

    i got some other problems with style though.
    problem appears if I use my own class inherited from QWidget
    Qt Code:
    1. class my_widget_class : public QWidget
    2. {
    3. Q_OBJECT
    4.  
    5. public:
    6. my_widget_class(QWidget* );
    7. QListView * listView;
    8. void mouseMoveEvent(QMouseEvent* pEvent);
    9.  
    10. };
    To copy to clipboard, switch view to plain text mode 
    implementation looks like this:
    Qt Code:
    1. my_widget_class* my_widget;
    2.  
    3. /* some ui code here */
    4.  
    5. my_widget = new my_widget_class (centralWidget);
    6. my_widget->setObjectName("my_widget_00");
    7. my_widget->setGeometry(QRect(100,100,100,200));
    To copy to clipboard, switch view to plain text mode 
    the style sheet is like this:
    Qt Code:
    1. my_widget_classt#my_widget_00 {
    2. background-color: blue;
    3. border-style: outset;
    4. border-width: 2px;
    5. border-radius: 20px;
    6. border-color: red;
    7. font: bold 14px;
    8. min-width: 10em;
    9. padding: 6px;
    10. }
    To copy to clipboard, switch view to plain text mode 
    i also tried style with QWidget#my_widget

    it works if i replace my_widget_class with QWidget in the code (like: "my_widget = new QWidget(centralWidget);" )
    is this a normal behaviour? i think it should recognise my new class as QWidget...
    i use the same method for my main window class, but this works fine.
    Last edited by muro345; 20th July 2010 at 12:04.

Similar Threads

  1. In the QTimer Slot, the setStyleSheet Problem
    By nightrain in forum Qt Programming
    Replies: 3
    Last Post: 29th December 2009, 10:39
  2. problem in QProgressBar setStyleSheet
    By wagmare in forum Qt Programming
    Replies: 3
    Last Post: 27th April 2009, 09:03
  3. Problem to setstylesheet
    By phillip_Qt in forum Qt Programming
    Replies: 3
    Last Post: 14th April 2008, 06:57
  4. using setStyleSheet
    By Weilor in forum Qt Programming
    Replies: 11
    Last Post: 18th January 2008, 13:41
  5. QSpinBox and setStylesheet problem
    By Ace-X in forum Qt Programming
    Replies: 2
    Last Post: 19th January 2007, 11:21

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.