This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rem deploy Qt Virtual Keyboard to project Build Directory | |
set qtdir=C:\Qt\5.9.5\msvc2015_64 | |
set builddir=C:\Development\qt\build\x86_64 | |
%qtdir%\bin\windeployqt.exe %builddir%\App.exe | |
copy /Y %qtdir%\bin\Qt5Qml.dll %builddir% | |
copy /Y %qtdir%\bin\Qt5Quick.dll %builddir% | |
copy /Y %qtdir%\plugins\platforminputcontexts\qtvirtualkeyboardplugin.dll %builddir% |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "richtextdelegate.h" | |
#include <QPainter> | |
#include <QTextDocument> | |
RichTextDelegate::RichTextDelegate(QObject *parent) : QStyledItemDelegate(parent) | |
{ | |
} | |
void RichTextDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "checkboxdelegate.h" | |
#include <QApplication> | |
CheckBoxDelegate::CheckBoxDelegate(QObject *parent) : QStyledItemDelegate(parent), scale(1.1) {} | |
void CheckBoxDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const | |
{ | |
QRect rect(option.rect.left() / scale, option.rect.top() / scale, option.rect.width() / scale, option.rect.height() / scale); | |
painter->save(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "swipetoeditdelegate.h" | |
#include <QApplication> | |
#include <QDebug> | |
#include <QMouseEvent> | |
#include <QTextDocument> | |
SwipeToEditDelegate::SwipeToEditDelegate(QObject* parent) : QStyledItemDelegate(parent), minRectWidth(10), activationThreshold(0.5), color("red") | |
{ | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "printjson.h" | |
#include <QJsonObject> | |
#include <QJsonValue> | |
#include <QJsonArray> | |
#include <QVariant> | |
#include <QTextStream> | |
#include <QRegularExpression> | |
QString sprintJson(const QJsonValue& jsonValue, int maxLength, int indentLevel) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
QString printJSON(const QJsonValue& jsonValue, int maxLength, int indentLevel) { | |
static const QString indent{QStringLiteral(" ")}; | |
static const QString cn{QStringLiteral(",\n")}; | |
QString whiteSpace(indent.repeated(indentLevel)); | |
switch(jsonValue.type()) { | |
case QJsonValue::Object: | |
{ | |
QStringList values; | |
QJsonObject o = jsonValue.toObject(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// LongPress: event filter Object for detecting Mouse pressed down for 1 second or more | |
// when triggered, it executes callback function supplied in the constructor | |
// usage: | |
/* | |
someButton->installEventFilter(new LongPress(this, [this] { | |
// do some stuff | |
})); | |
*/ |