<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                [TOC] ## 概述 常用函數 ``` void addLibraryPath(const QString &path) QString applicationDirPath() QString applicationFilePath() QString applicationName() qint64 applicationPid() QString applicationVersion() QStringList arguments() bool closingDown() int exec() void exit(int returnCode = 0) QCoreApplication * instance() QStringList libraryPaths() QString organizationDomain() QString organizationName() void postEvent(QObject *receiver, QEvent *event, int priority = Qt::NormalEventPriority) void processEvents(QEventLoop::ProcessEventsFlags flags = QEventLoop::AllEvents) void processEvents(QEventLoop::ProcessEventsFlags flags, int maxtime) void removeLibraryPath(const QString &path) void removePostedEvents(QObject *receiver, int eventType = 0) bool sendEvent(QObject *receiver, QEvent *event) void sendPostedEvents(QObject *receiver = Q_NULLPTR, int event_type = 0) void setApplicationName(const QString &application) void setApplicationVersion(const QString &version) void setAttribute(Qt::ApplicationAttribute attribute, bool on = true) void setLibraryPaths(const QStringList &paths) void setOrganizationDomain(const QString &orgDomain) void setOrganizationName(const QString &orgName) ``` ### processEvents **應用場景一:處理密集耗時的事情** - 有時候需要處理一些跟界面無關的但非常耗時的事情,這些事情跟界面在同一個線程中,由于時間太長,導致界面無法響應,處于“假死”狀態。 2. 例如:在應用程序中保存文件到硬盤上,從開始保存直到文件保存完畢,程序不響應用戶的任何操作,窗口也不會重新繪制,從而處于“無法響應”狀態 ``` connect(button, &QPushButton::clicked, [=]() { timer->start(1); for (int i = 0; i < 2000000000; i++){ QCoreApplication::processEvents(); }; timer->stop(); }); ``` ### postEvent - 異步發送事件 ``` void QCoreApplication::postEvent(QObject *receiver, QEvent *event, int priority = Qt::NormalEventPriority) ``` 利用 Application::postEvent() 分發事件,或使用隊列式的信號槽連接, 都是用于線程間通信的安全機制--但需要接收線程處于事件循環中 ## 示例 有時候需要處理一些跟界面無關的但非常耗時的事情,這些事情跟界面在同一個線程中,由于時間太長,導致界面無法響應,處于“假死”狀態。例如:在應用程序中保存文件到硬盤上,從開始保存直到文件保存完畢,程序不響應用戶的任何操作,窗口也不會重新繪制,從而處于“無法響應”狀態
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看