mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-05 01:20:42 +00:00
Add menu-showing function to RDDialog (using manual event loop pump)
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
#include "CaptureContext.h"
|
||||
#include <QApplication>
|
||||
#include <QFileInfo>
|
||||
#include <QMenu>
|
||||
#include <QMessageBox>
|
||||
#include <QMetaObject>
|
||||
#include <QStandardPaths>
|
||||
@@ -282,6 +283,18 @@ void GUIInvoke::blockcall(const std::function<void()> &f)
|
||||
QMetaObject::invokeMethod(invoke, "doInvoke", Qt::BlockingQueuedConnection);
|
||||
}
|
||||
|
||||
void RDDialog::show(QMenu *menu, QPoint pos)
|
||||
{
|
||||
menu->setWindowModality(Qt::ApplicationModal);
|
||||
menu->popup(pos);
|
||||
QEventLoop loop;
|
||||
while(menu->isVisible())
|
||||
{
|
||||
loop.processEvents(QEventLoop::WaitForMoreEvents);
|
||||
QCoreApplication::sendPostedEvents();
|
||||
}
|
||||
}
|
||||
|
||||
void RDDialog::show(QDialog *dialog)
|
||||
{
|
||||
dialog->setWindowModality(Qt::ApplicationModal);
|
||||
|
||||
@@ -253,9 +253,12 @@ public:
|
||||
bool isRunning() { return m_Thread; }
|
||||
};
|
||||
|
||||
class QMenu;
|
||||
|
||||
// helper for doing a manual blocking invoke of a dialog
|
||||
struct RDDialog
|
||||
{
|
||||
static void show(QMenu *menu, QPoint pos);
|
||||
static void show(QDialog *dialog);
|
||||
static QMessageBox::StandardButton messageBox(
|
||||
QMessageBox::Icon, QWidget *parent, const QString &title, const QString &text,
|
||||
|
||||
Reference in New Issue
Block a user