Pyqt Dialogsのロゴ

Pyqt Dialogs

組織
CodeAtCode
pyqt-dialogs

Use when implementing PyQt/PySide6 dialogs - standard dialogs (QFileDialog, QMessageBox, QInputDialog, QColorDialog, QFontDialog), custom QDialog patterns, modal vs modeless dialogs, input validation, Qt 6 dialog APIs

概要

公開者CodeAtCode
リポジトリoss-ai-skills
スキル名pyqt-dialogs
スター
30
フォーク
3
同梱ファイル
4
ライセンスGPL-3.0
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 4個の同梱ファイル

    モデルが作業中に読み取れるスクリプト、テンプレート、参考資料です。ファイルは読み取り専用で、実行されることはありません。

  • オープンソース

    CodeAtCodeがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキルPyqt DialogsをTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/CodeAtCode/oss-ai-skills/tree/master/frameworks/pyqt/dialogs
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/CodeAtCode/oss-ai-skills.git /tmp/oss-ai-skills
mkdir -p .claude/skills
cp -r /tmp/oss-ai-skills/frameworks/pyqt/dialogs .claude/skills/pyqt-dialogs
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでPyqt Dialogsを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあると、モデルが自動的にPyqt Dialogsを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Pyqt Dialogsは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、未使用のスキルにはコストがかかりません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

PyQt Dialogs

Standard and custom dialog patterns for PyQt/PySide6 applications.

Objective: Use this skill to reduce modal-deadlock incidents, rejected-input data loss, dialog-sizing regressions, native-vs-custom dialog mismatches by enforcing modal discipline (exec() vs open()), validation-at-boundary rules, and QDialogButtonBox usage patterns.

Modal vs Modeless Discipline

Use exec() for modal dialogs because open() returns immediately and callers race to access results before the user responds.

Use show() for modeless dialogs because blocking the UI prevents user interaction with other windows (search dialogs, find/replace).

python
# ✅ Modal - blocks until user responds
dialog = MyDialog(parent)
if dialog.exec() == QDialog.Accepted:
    values = dialog.get_values()  # Safe: user has already responded

# ❌ BAD - race condition
dialog = MyDialog(parent)
dialog.open()  # Returns immediately
values = dialog.get_values()  # May read stale data before user responds

# ✅ Modeless - stays open, emits signals
dialog = SearchDialog(parent)
dialog.searchRequested.connect(self.perform_search)
dialog.show()  # Non-blocking

Standard Dialogs — Decision Guide

When to Use Each Dialog Type

  • QFileDialog — File/directory selection. Use static methods for simple cases; subclass for custom behavior.
  • QMessageBox — Confirmation, warnings, errors. Use static methods for quick yes/no/information.
  • QInputDialog — Simple user input (text, number, selection). Use when you need a single value.
  • QColorDialog / QFontDialog — Color/font selection. Use native dialogs for consistency.
  • Custom QDialog — Complex input, multi-field forms, multi-page wizards.

API Reference Relocation

See references/qfiledialog-apis.md for QFileDialog static method syntax. See references/qmessagebox-apis.md for QMessageBox button flags and message types. See references/qinputdialog-apis.md for QInputDialog input modes. See references/color-font-dialogs.md for QColorDialog and QFontDialog APIs.

Custom Dialogs

Basic Custom Dialog Pattern

Do subclass QDialog because standard dialogs cannot handle complex multi-field forms or custom validation logic.

python
from PySide6.QtWidgets import (
    QDialog, QVBoxLayout, QHBoxLayout, QLabel,
    QLineEdit, QDialogButtonBox, QFormLayout
)

class InputDialog(QDialog):
    def __init__(self, parent=None):
        super().__init__(parent)
        self.setWindowTitle("Input Dialog")
        self.setMinimumWidth(400)  # Prevent undersizing
        
        layout = QVBoxLayout(self)
        
        # Form
        form = QFormLayout()
        self.name_edit = QLineEdit()
        self.email_edit = QLineEdit()
        form.addRow("Name:", self.name_edit)
        form.addRow("Email:", self.email_edit)
        layout.addLayout(form)
        
        # Buttons - use QDialogButtonBox for correct platform ordering
        buttons = QDialogButtonBox(
            QDialogButtonBox.StandardButton.Ok |
            QDialogButtonBox.StandardButton.Cancel
        )
        buttons.accepted.connect(self.accept)
        buttons.rejected.connect(self.reject)
        layout.addWidget(buttons)
    
    def get_values(self):
        return {
            "name": self.name_edit.text(),
            "email": self.email_edit.text()
        }

# Usage
dialog = InputDialog(parent)
if dialog.exec() == QDialog.Accepted:
    values = dialog.get_values()

Validation at Boundary

Do validate in try_accept() before calling accept() because accepted dialogs with invalid data propagate errors downstream and force callers to handle bad state.

python
class ValidatedDialog(QDialog):
    def __init__(self, parent=None):
        super().__init__(parent)
        self.setWindowTitle("Validated Input")
        
        layout = QVBoxLayout(self)
        
        form = QFormLayout()
        self.age_spin = QSpinBox()
        self.age_spin.setRange(0, 120)
        self.email_edit = QLineEdit()
        form.addRow("Age:", self.age_spin)
        form.addRow("Email:", self.email_edit)
        layout.addLayout(form)
        
        # Error label - show validation feedback
        self.error_label = QLabel()
        self.error_label.setStyleSheet("color: red;")
        layout.addWidget(self.error_label)
        
        # Connect OK button to validation wrapper
        self.buttons = QDialogButtonBox(
            QDialogButtonBox.StandardButton.Ok |
            QDialogButtonBox.StandardButton.Cancel
        )
        self.buttons.accepted.connect(self.try_accept)  # NOT self.accept
        self.buttons.rejected.connect(self.reject)
        layout.addWidget(self.buttons)
    
    def try_accept(self):
        """Validate before accepting — prevents invalid state propagation."""
        if not self.validate():
            return  # Block accept() if validation fails
        self.accept()
    
    def validate(self):
        email = self.email_edit.text()
        if not email:
            self.error_label.setText("Email is required")
            return False
        
        if not re.match(r"[^@]+@[^@]+\.[^@]+", email):
            self.error_label.setText("Invalid email format")
            return False
        
        self.error_label.clear()
        return True

Modeless Dialog Pattern

Do use signals for modeless dialogs because the dialog needs to communicate results without blocking the parent or requiring polling.

python
class SearchDialog(QDialog):
    """Non-modal dialog that stays open and emits results via signals."""
    searchRequested = Signal(str)
    
    def __init__(self, parent=None):
        super().__init__(parent)
        self.setWindowTitle("Search")
        # Set window flags for modeless behavior
        self.setWindowFlags(
            Qt.WindowType.Dialog |
            Qt.WindowType.WindowCloseButtonHint
        )
        
        layout = QVBoxLayout(self)
        
        self.search_edit = QLineEdit()
        self.search_edit.setPlaceholderText("Enter search term...")
        self.search_edit.returnPressed.connect(self.search)
        
        self.search_btn = QPushButton("Search")
        self.search_btn.clicked.connect(self.search)
        
        layout.addWidget(self.search_edit)
        layout.addWidget(self.search_btn)
    
    def search(self):
        term = self.search_edit.text()
        if term:
            self.searchRequested.emit(term)  # Signal result to parent

# Usage
search_dialog = SearchDialog(parent)
search_dialog.searchRequested.connect(parent.perform_search)
search_dialog.show()  # Non-modal — dialog stays open

Best Practices

  1. Use QDialogButtonBox for standard buttons because it ensures correct button ordering per platform (OK/Cancel order varies by OS).

  2. Always provide Cancel button because users need an escape path; dialogs without cancel trap users in error states.

  3. Pass parent to all dialogs because dialogs without parents become orphaned windows that can appear behind main windows or lose modality.

  4. Set minimum size on custom dialogs because dialogs that are too small truncate content and create poor UX.

  5. Validate before accept() because downstream code assumes dialog data is valid after QDialog.Accepted.

  6. Use exec() for modal, show() for modeless because mixing them causes race conditions (exec() blocks, show() doesn't).

Qt 6 Modern Patterns

QDialog Setup Pattern

python
class MyDialog(QDialog):
    def __init__(self, parent=None):
        super().__init__(parent)
        self.setWindowTitle("Settings")
        self.setModal(True)
        
        layout = QVBoxLayout()
        # ... widgets ...
        
        # Use setLayout() instead of layout = ...; self.setLayout(layout)
        self.setLayout(layout)
        
        # Standard button box
        btn_box = QDialogButtonBox(
            QDialogButtonBox.Ok | QDialogButtonBox.Cancel
        )
        btn_box.accepted.connect(self.accept)
        btn_box.rejected.connect(self.reject)
        layout.addWidget(btn_box)

Deep Dives

For detailed API reference, see the following files loaded on demand:

  • references/qfiledialog-apis.md — QFileDialog static methods and options
  • references/qmessagebox-apis.md — QMessageBox button flags and message types
  • references/qinputdialog-apis.md — QInputDialog input modes
  • references/color-font-dialogs.md — QColorDialog and QFontDialog APIs

References

同梱ファイル

スキルが読み込まれている間、モデルは必要に応じてこれらを読み取ります。読み取り可能なファイルとして提供され、実行されることはありません。

よくある質問

AIスキル「Pyqt Dialogs」では何ができますか?

Use when implementing PyQt/PySide6 dialogs - standard dialogs (QFileDialog, QMessageBox, QInputDialog, QColorDialog, QFontDialog), custom QDialog patterns, modal vs modeless dialogs, input validation, Qt 6 dialog APIs

TypingMindでPyqt Dialogsを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Pyqt Dialogsはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにPyqt Dialogsをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/CodeAtCode/oss-ai-skills/tree/master/frameworks/pyqt/dialogsを貼り付けてください。TypingMindがSKILL.mdを読み込み、関連ファイルをまとめて、チャットごとに有効にできるスキルとしてインストールします。

Pyqt Dialogsを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストが合致したときにこのスキルを読み込めます。

Pyqt Dialogsは何個のAIモデルで使えますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもPyqt Dialogsを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Pyqt Dialogs」は無料ですか?

はい。CodeAtCodeがGitHubでGPL-3.0ライセンスの下で公開しています。支払いが必要なのは、利用したトークンに対する、ご自身が契約するAIプロバイダーへの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇