mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-09-08 23:05:46 +00:00
Add MiniQtHelper functions for scrolling widgets
This commit is contained in:
@@ -695,6 +695,20 @@ add text next to it.
|
||||
)");
|
||||
virtual rdcstr GetWidgetText(QWidget *widget) = 0;
|
||||
|
||||
DOCUMENT(R"(Scroll the widget's vertical scrollbar to the top. If the widget has no scrollbar
|
||||
this will do nothing
|
||||
|
||||
:param QWidget widget: The widget to scroll in.
|
||||
)");
|
||||
virtual void ScrollToTop(QWidget *widget) = 0;
|
||||
|
||||
DOCUMENT(R"(Scroll the widget's vertical scrollbar to the bottom. If the widget has no scrollbar
|
||||
this will do nothing
|
||||
|
||||
:param QWidget widget: The widget to scroll in.
|
||||
)");
|
||||
virtual void ScrollToBottom(QWidget *widget) = 0;
|
||||
|
||||
DOCUMENT(R"(Change the font properties of a widget.
|
||||
|
||||
:param QWidget widget: The widget to change font of.
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <QProgressBar>
|
||||
#include <QPushButton>
|
||||
#include <QRadioButton>
|
||||
#include <QScrollBar>
|
||||
#include <QVBoxLayout>
|
||||
#include <QWidget>
|
||||
#include "Code/QRDUtils.h"
|
||||
@@ -412,6 +413,26 @@ rdcstr MiniQtHelper::GetWidgetText(QWidget *widget)
|
||||
return widget->windowTitle();
|
||||
}
|
||||
|
||||
void MiniQtHelper::ScrollToTop(QWidget *widget)
|
||||
{
|
||||
if(!widget)
|
||||
return;
|
||||
|
||||
QAbstractScrollArea *w = qobject_cast<QAbstractScrollArea *>(widget);
|
||||
if(w)
|
||||
w->verticalScrollBar()->setSliderPosition(w->verticalScrollBar()->minimum());
|
||||
}
|
||||
|
||||
void MiniQtHelper::ScrollToBottom(QWidget *widget)
|
||||
{
|
||||
if(!widget)
|
||||
return;
|
||||
|
||||
QAbstractScrollArea *w = qobject_cast<QAbstractScrollArea *>(widget);
|
||||
if(w)
|
||||
w->verticalScrollBar()->setSliderPosition(w->verticalScrollBar()->maximum());
|
||||
}
|
||||
|
||||
void MiniQtHelper::SetWidgetFont(QWidget *widget, const rdcstr &font, int32_t fontSize, bool bold,
|
||||
bool italic)
|
||||
{
|
||||
|
||||
@@ -74,6 +74,9 @@ public:
|
||||
void SetWidgetText(QWidget *widget, const rdcstr &text) override;
|
||||
rdcstr GetWidgetText(QWidget *widget) override;
|
||||
|
||||
void ScrollToTop(QWidget *widget) override;
|
||||
void ScrollToBottom(QWidget *widget) override;
|
||||
|
||||
void SetWidgetFont(QWidget *widget, const rdcstr &font, int32_t fontSize, bool bold,
|
||||
bool italic) override;
|
||||
|
||||
|
||||
@@ -182,6 +182,12 @@ struct MiniQtInvoker : UIThreadInvoker<IMiniQtHelper>
|
||||
return InvokeRetFunction<rdcstr>(&IMiniQtHelper::GetWidgetText, widget);
|
||||
}
|
||||
|
||||
void ScrollToTop(QWidget *widget) { InvokeVoidFunction(&IMiniQtHelper::ScrollToTop, widget); }
|
||||
void ScrollToBottom(QWidget *widget)
|
||||
{
|
||||
InvokeVoidFunction(&IMiniQtHelper::ScrollToBottom, widget);
|
||||
}
|
||||
|
||||
void SetWidgetFont(QWidget *widget, const rdcstr &font, int32_t fontSize, bool bold, bool italic)
|
||||
{
|
||||
InvokeVoidFunction(&IMiniQtHelper::SetWidgetFont, widget, font, fontSize, bold, italic);
|
||||
|
||||
Reference in New Issue
Block a user