Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Window partially refreshed
Forum Updated to NodeBB v4.3 + New Features

Window partially refreshed

Scheduled Pinned Locked Moved QML and Qt Quick
16 Posts 5 Posters 5.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jrlaff
    wrote on last edited by
    #7

    @#ifndef QTAPPLICATION_H
    #define QTAPPLICATION_H

    #include <QApplication>
    #include <qqmlapplicationengine.h>
    #include <QQuickView.h>
    #include "QtAdapter.h"
    #include "QtTranslationManager.h"
    #include "QtThemeManager.h"
    #include "ObjectListManager.h"
    #include "UIList.h"

    class CGUIModuleAdapter;

    class CLayoutHandler;
    class CComponentHandler;
    class CBaseHandler;
    class HandlerComparer;

    typedef stdext::hash_map<WORD, CLayoutHandler> LayoutHandlerMap;
    typedef std::list<CBaseHandler *> HandlerPropertiesToSet;
    typedef stdext::hash_multiset<CLayoutHandler *, HandlerComparer> LayoutsToDraw;
    typedef std::list<CBaseHandler *> ComponentsToDraw;
    typedef std::list<CLayoutHandler *> LayoutsToDispose;
    typedef std::list<CBaseHandler *> ComponentsToDispose;

    typedef struct
    {
    LayoutHandlerMap * pLayouts;
    HandlerPropertiesToSet * pHandlerPropertiesToSet;
    LayoutsToDraw * pLayoutsToDraw;
    ComponentsToDraw * pComponentsToDraw;
    LayoutsToDispose * pLayoutsToDispose;
    ComponentsToDispose * pComponentsToDispose;
    } QtSetup;

    typedef stdext::hash_map<CUString, QQuickItem *, UStringCaseComparerDefault> QuickItemsMap;

    class CQtApplication : public QApplication
    {
    Q_OBJECT

    public:
    CQtApplication ( const CUString & local, const CUString & theme, int &argc, char **argv );

    CQtAdapter & GetQtAdapter ();

    QQuickView * GetQtView ();

    void SetModule ( CGUIModuleAdapter * pModule );
    CGUIModuleAdapter * GetModule ();
    void SetView ( QQuickView * pView );

    CObjectListManager * GetObjectListManager ();

    private:
    CLogTrace m_trace;
    static CLogTrace m_staticTrace;

    bool m_qtInitialized;

    QtSetup * m_pSetup;

    CQtAdapter m_qtAdapter;

    CGUIModuleAdapter * m_pModule;

    QQuickView * m_pView;

    CQtTranslationManager m_qtTranslationManager;
    CQtThemeManager m_qtThemeManager;

    CObjectListManager m_objectListManager;

    static int Argc;

    static void customMessageHandler ( QtMsgType type, const QMessageLogContext &context, const QString &msg );

    signals:
    void eventSignal ();

    bool macroListSelectionSignal( QString name, QString key, int action, bool bPressAndHold );
    bool macroSelectionSignal ( QString name, QString eventName, bool bPressAndHold );

    public slots:
    void updateSlot ( HANDLE hProcessedEvent );
    void configureSlot ( HANDLE hProcessedEvent );
    void themeUpdateSlot ( QString theme );
    void languageUpdateSlot ( QString language );
    void setupSlot ( QtSetup * pSetup );

    bool macroListSelectionSlot ( CUString & listName, int itemIndex, CUIList::Action action, bool bPressAndHold, bool bFastList );
    bool macroSelectionSlot ( CBaseHandler * handler, CUString & buttonName, bool bPressAndHold );
    };

    #endif // QTAPPLICATION_H
    @

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #8

      What is CLogTrace ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • J Offline
        J Offline
        jrlaff
        wrote on last edited by
        #9

        A simple class that provides log tracing features. It is not linked to Qt.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #10

          Do you have any static QWidget ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • J Offline
            J Offline
            jrlaff
            wrote on last edited by
            #11

            I will double check but I don't think so.

            Could you please provide me with the minimal code that creates an application that displays a topmost window (and gets its view from a QML file)? I will try it here and eventually find the differences that make my code fail...

            Thank you.

            1 Reply Last reply
            0
            • S Offline
              S Offline
              sailorv5
              wrote on last edited by
              #12

              Check :
              @
              QWidget::setFocusPolicy( );
              @

              // check AnalogClock Exemple to see how paintEvent work

              @
              void AnalogClock::paintEvent(QPaintEvent *event )
              @

              if u just dont got it yet just google for :

              bq. qt multi thread example.

              1 Reply Last reply
              0
              • J Offline
                J Offline
                jrlafff
                wrote on last edited by
                #13

                After playing around, I found the way to get my application window topmost.

                I changed the way my QML application loads its content by:

                1. Using a QQmlApplicationEngine instead of a QQuickView to load my main QML file;
                2. Switching to a Window item (instead of an Item).

                This way, I can control the window and apply the Qt::WindowStaysOnTopHint flag on it.

                Regarding the refresh issue, I did not find the solution but rather implemented a (dirty) workaround which consists of resetting the window size (width = width + 1; width = width - 1;) as soon as the window's active property changes. This forces the redraw of the entire window. This is not very elegant, but it does the job for now.

                1 Reply Last reply
                0
                • ? Offline
                  ? Offline
                  A Former User
                  wrote on last edited by
                  #14

                  Hi,

                  are you using OpenGL or DirectX via ANGLE? Looks like a bug with OpenGL to me. If your environment is configured to support both, OpenGL and ANGLE, you can force your application to use ANGLE by calling

                  QCoreApplication::setAttribute( Qt::AA_UseOpenGLES );

                  before instantiating your QApplication.

                  Cheers!
                  Wieland

                  1 Reply Last reply
                  0
                  • J Offline
                    J Offline
                    jrlafff
                    wrote on last edited by jrlafff
                    #15

                    Hi,

                    The application runs with ANGLE. OpenGL is not an option, as the hardware that must run the application only supports OpenGL 2.0, and I have errors when forcing the use of OpenGL (could not create shader program) that tell me that OpenGL version is too low.

                    The dirty trick mentioned above is not sufficient as it happens even when another non-focusable window comes in front of my main application window... So my main window never loses focus.

                    1 Reply Last reply
                    0
                    • J Offline
                      J Offline
                      jrlafff
                      wrote on last edited by
                      #16

                      I finally got a workaround solution for the issue.

                      It turns out that setting the render loop to threaded mode seems to prevent the refresh issues from occurring. In my case, this works:

                      qputenv( "QSG_RENDER_LOOP", "threaded" );

                      See the following link explaining the difference between the threaded and the non-threaded render loop, and thee default value (non-threaded) on Widows with ANGLE.

                      I found it when looking at a similar issue:
                      https://bugreports.qt.io/browse/QTBUG-30763

                      Regards,

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved