Take the 2-minute tour ×

I have two Qt projects. The first project builds a library that provides a widget for the main window. The second project then uses this library and creates custom widgets to plug into it and define implementation.

Everything works properly except for the graphics not showing up in the second project that includes the library. The widgets show up just fine, but nothing from the stylesheet is displayed.

Is there something else I'm forgetting to do?

For example, I've made this frame...

namespace saiwidgets {

class SAIWIDGETSSHARED_EXPORT Frame : public QFrame {
    explicit Frame(QFrame* parent  = nullptr);
    Frame(QWidget* widget, QFrame* parent  = nullptr);

    void addWidget(QWidget* value);

    virtual void mouseMoveEvent(QMouseEvent *e) override;

    QVBoxLayout layout;


And load the stylesheet like this...

QApplication a(argc, argv);

QFile styleFile( %path to the stylesheet% );
styleFile.open( QFile::ReadOnly );

QString style( styleFile.readAll() );
a.setStyleSheet( style );

Implementation omitted...

SOLUTION: Well, the solution is simple and obvious — just apply the stylesheet to the parent window.

share|improve this question
Welcome to StackOverflow! You haven't shown any code, which is going to make it very hard for anybody to troubleshoot the problem. What have you tried? –  Lynn Crumbling May 22 '13 at 3:46
Thank you. Well, I just inherited Qt widgets and placed them into the library... but okay :3 I'll add the example. –  Newlifer May 22 '13 at 3:56
Also I tried to apply the stylesheet manually right in the custom widget, it works, of course... –  Newlifer May 22 '13 at 4:32
add comment


Your Answer



Browse other questions tagged or ask your own question.