Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Unsolved QDockWidgetのアクティブウィンドウの取得方法

    Japanese
    2
    2
    1274
    Loading More Posts
    • 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.
    • T
      totsuka last edited by

      戸塚と申します。

      現在QDockWidgetを利用した画面制御を考えているのですが、
      アクティブとなったDockWidgetが取得できずに困っております。

      開発環境:
      ・Windows10
      ・VS2015 (C++)
      ・Qt5.10.0

      やりたい事:
      DockWidget内に複数のウィンドウが存在し、Floatingも許可している状態。
      最後にアクティブにしたウィンドウに合わせてメニューやToolbarの状態を変化したい。

      困っている事:
      ウィンドウがfloating中であれば、ウィンドウのアクティブ状態を取得すればなんとかなる事はわかりましたが、MainWindows内にドッキングしている状態(左右での2面表示等)の場合に、どれがアクティブなウィンドウかを取得する方法がわかりません。

      可能であればfloating中のウィンドウも含めて、トップレベル(最後に触った)ウィンドウを取得する方法を知りたいです。

      是非ご回答宜しくお願いいたします。

      joeQ 1 Reply Last reply Reply Quote 0
      • joeQ
        joeQ @totsuka last edited by

        @totsuka Hi, friend, welcome.

        私はアプリの一番上のウィンドウを取得する場合は、Googleの翻訳ツールを使用します。

        メソッドを試すことができます。

        [static] QWindow *QGuiApplication::topLevelAt(const QPoint &pos)
        Returns the top level window at the given position pos, if any.

        [static] QWindowList QGuiApplication::topLevelWindows()
        Returns a list of the top-level windows in the application.
        See also allWindows().

        コミュニケーションには英語を使うのが最善です。

        Just do it!

        1 Reply Last reply Reply Quote 0
        • First post
          Last post