mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
qt: General qt/c++ related fixes and updates (#3562)
* qt: Draw a border around net traffic graph * qt: ReceiveRequestDialog - Improve QR code image - Fix issue with bluriness - Refine sizing/layout of QR code and address - Adjust coloring to match the themes * qt: Give the TransactionView's instantsendWidget a name Required to access it in css * qt: Rename conflicting label in SendCoinsDialog - Was named the same as the the label in EditAddressDialog so it couldn't be accessed properly in css * qt: Give the TransactionView's search field the first focus on startup * qt: Some updates to the PrivateSend widget on the OverviewPage - Hide denom labels if inactive - Enable wordwrap for denom label - Add some spacer - Make sure it gets its basic initialization on startup * qt: Fix some layout issues in SendCoinsDialog's UI file. - Added some margins for fee selection radio buttons to align them centered to their options - Removed a weird placed spacer * qt: Fix vertical alignment of the two balance labels in SendCoinsDialog * qt: Add newline in textedit of receiverequest * qt: OptionsDialog - Hide override hint if there is nothing overridden * qt: Allow stylesheet modifications for auto completition popup - Inheritance doesn't work here obviously because of QCompleter is parent of the popup - QStyledItemDelegate delegate is required. Without its not possible to access `::item` selectors from css. * qt: Make the progress label in the status bar accessible in css * qt: Update weekend colors of QCalendarWidget on style changes Its obviously not possible to do this in stylesheets thats why i added this as workaround. * qt: Load stylesheets for Intro This is the datadir selection dialog. * Drop labelPrivateSendLastMessage * Add a space Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com> Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com> Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
This commit is contained in:
parent
415e504780
commit
354ff23c68
@ -216,6 +216,7 @@ BitcoinGUI::BitcoinGUI(const PlatformStyle *_platformStyle, const NetworkStyle *
|
||||
// Progress bar and label for blocks download
|
||||
progressBarLabel = new QLabel();
|
||||
progressBarLabel->setVisible(true);
|
||||
progressBarLabel->setObjectName("lblStatusBarProgress");
|
||||
progressBar = new GUIUtil::ProgressBar();
|
||||
progressBar->setAlignment(Qt::AlignCenter);
|
||||
progressBar->setVisible(true);
|
||||
|
@ -475,6 +475,9 @@
|
||||
<property name="text">
|
||||
<string>n/a</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
@ -482,30 +485,63 @@
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="VerticalLayout_PS">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelPrivateSendLastMessage">
|
||||
<property name="text">
|
||||
<string>(Last Message)</string>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="togglePrivateSend">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Start/Stop Mixing</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="togglePrivateSend">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Start/Stop Mixing</string>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
|
@ -778,8 +778,11 @@
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayoutFee13">
|
||||
<layout class="QHBoxLayout" name="horizontalLayoutFee13" stretch="0,0,1">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelCustomPerKilobyte">
|
||||
<property name="toolTip">
|
||||
@ -855,6 +858,12 @@
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayoutFee4" stretch="0,1">
|
||||
<property name="topMargin">
|
||||
<number>20</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioSmartFee">
|
||||
<property name="text">
|
||||
@ -885,6 +894,9 @@
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayoutFee9" stretch="0,1">
|
||||
<property name="topMargin">
|
||||
<number>30</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioCustomFee">
|
||||
<property name="text">
|
||||
@ -916,7 +928,10 @@
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayoutFee12">
|
||||
@ -976,19 +991,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>1</width>
|
||||
<height>1</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
@ -1136,7 +1138,7 @@
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<widget class="QLabel" name="labelBalanceText">
|
||||
<property name="text">
|
||||
<string>Balance:</string>
|
||||
</property>
|
||||
@ -1145,7 +1147,7 @@
|
||||
<item>
|
||||
<widget class="QLabel" name="labelBalance">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
|
@ -206,6 +206,7 @@ bool Intro::pickDataDirectory()
|
||||
/* Let the user choose one */
|
||||
Intro intro;
|
||||
GUIUtil::disableMacFocusRect(&intro);
|
||||
GUIUtil::loadStyleSheet(&intro);
|
||||
intro.setDataDirectory(dataDirDefaultCurrent);
|
||||
intro.setWindowIcon(QIcon(":icons/bitcoin"));
|
||||
|
||||
|
@ -167,9 +167,11 @@ void OptionsDialog::setModel(OptionsModel *_model)
|
||||
showRestartWarning(true);
|
||||
|
||||
QString strLabel = _model->getOverriddenByCommandLine();
|
||||
if (strLabel.isEmpty())
|
||||
strLabel = tr("none");
|
||||
ui->overriddenByCommandLineLabel->setText(strLabel);
|
||||
if (strLabel.isEmpty()) {
|
||||
ui->frame->setHidden(true);
|
||||
} else {
|
||||
ui->overriddenByCommandLineLabel->setText(strLabel);
|
||||
}
|
||||
|
||||
mapper->setModel(_model);
|
||||
setMapper();
|
||||
|
@ -305,6 +305,9 @@ void OverviewPage::setWalletModel(WalletModel *model)
|
||||
// explicitly update PS frame and transaction list to reflect actual settings
|
||||
updateAdvancedPSUI(model->getOptionsModel()->getShowAdvancedPSUI());
|
||||
|
||||
// Initialize PS UI
|
||||
privateSendStatus(true);
|
||||
|
||||
if(!privateSendClient.fEnablePrivateSend) return;
|
||||
|
||||
connect(model->getOptionsModel(), SIGNAL(privateSendRoundsChanged()), this, SLOT(updatePrivateSendProgress()));
|
||||
@ -467,15 +470,23 @@ void OverviewPage::updateAdvancedPSUI(bool fShowAdvancedPSUI) {
|
||||
ui->privateSendProgress->setVisible(fShowAdvancedPSUI);
|
||||
ui->labelSubmittedDenomText->setVisible(fShowAdvancedPSUI);
|
||||
ui->labelSubmittedDenom->setVisible(fShowAdvancedPSUI);
|
||||
ui->labelPrivateSendLastMessage->setVisible(fShowAdvancedPSUI);
|
||||
}
|
||||
|
||||
void OverviewPage::privateSendStatus()
|
||||
void OverviewPage::privateSendStatus(bool fForce)
|
||||
{
|
||||
if(!masternodeSync.IsBlockchainSynced() || ShutdownRequested()) return;
|
||||
if (!fForce && (!masternodeSync.IsBlockchainSynced() || ShutdownRequested())) return;
|
||||
|
||||
if(!walletModel) return;
|
||||
|
||||
auto tempWidgets = {ui->labelSubmittedDenomText,
|
||||
ui->labelSubmittedDenom};
|
||||
|
||||
auto setWidgetsVisible = [&](bool fVisible) {
|
||||
for (const auto& it : tempWidgets) {
|
||||
it->setVisible(fVisible);
|
||||
}
|
||||
};
|
||||
|
||||
static int64_t nLastDSProgressBlockTime = 0;
|
||||
int nBestHeight = clientModel->getNumBlocks();
|
||||
|
||||
@ -495,7 +506,7 @@ void OverviewPage::privateSendStatus()
|
||||
updatePrivateSendProgress();
|
||||
}
|
||||
|
||||
ui->labelPrivateSendLastMessage->setText("");
|
||||
setWidgetsVisible(false);
|
||||
ui->togglePrivateSend->setText(tr("Start Mixing"));
|
||||
|
||||
QString strEnabled = tr("Disabled");
|
||||
@ -574,14 +585,7 @@ void OverviewPage::privateSendStatus()
|
||||
updatePrivateSendProgress();
|
||||
}
|
||||
|
||||
QString strStatus = QString(privateSendClient.GetStatuses().c_str());
|
||||
|
||||
QString s = tr("Last PrivateSend message:\n") + strStatus;
|
||||
|
||||
if(s != ui->labelPrivateSendLastMessage->text())
|
||||
LogPrint(BCLog::PRIVATESEND, "OverviewPage::privateSendStatus -- Last PrivateSend message: %s\n", strStatus.toStdString());
|
||||
|
||||
ui->labelPrivateSendLastMessage->setText(s);
|
||||
setWidgetsVisible(true);
|
||||
|
||||
ui->labelSubmittedDenom->setText(QString(privateSendClient.GetSessionDenoms().c_str()));
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ public:
|
||||
void showOutOfSyncWarning(bool fShow);
|
||||
|
||||
public Q_SLOTS:
|
||||
void privateSendStatus();
|
||||
void privateSendStatus(bool fForce = false);
|
||||
void setBalance(const CAmount& balance, const CAmount& unconfirmedBalance, const CAmount& immatureBalance, const CAmount& anonymizedBalance,
|
||||
const CAmount& watchOnlyBalance, const CAmount& watchUnconfBalance, const CAmount& watchImmatureBalance);
|
||||
|
||||
|
@ -137,7 +137,7 @@ void ReceiveRequestDialog::update()
|
||||
ui->btnSaveAs->setEnabled(false);
|
||||
QString html;
|
||||
html += "<html>";
|
||||
html += "<b>"+tr("Payment information")+"</b><br>";
|
||||
html += "<b>" + tr("Payment information") + "</b><br><br>";
|
||||
html += "<b>"+tr("URI")+"</b>: ";
|
||||
html += QString("<a style=\"%1\"href=\"").arg(GUIUtil::getThemedStyleQString(GUIUtil::ThemedStyle::TS_COMMAND)) +
|
||||
uri + "\">" + GUIUtil::HtmlEscape(uri) + "</a><br>";
|
||||
@ -165,34 +165,39 @@ void ReceiveRequestDialog::update()
|
||||
ui->lblQRCode->setText(tr("Error encoding URI into QR Code."));
|
||||
return;
|
||||
}
|
||||
QImage qrImage = QImage(code->width + 8, code->width + 8, QImage::Format_RGB32);
|
||||
QImage qrImage = QImage(code->width + 6, code->width + 6, QImage::Format_RGB32);
|
||||
qrImage.fill(GUIUtil::getThemedQColor(GUIUtil::ThemedColor::BACKGROUND_WIDGET));
|
||||
unsigned char *p = code->data;
|
||||
for (int y = 0; y < code->width; y++)
|
||||
{
|
||||
for (int x = 0; x < code->width; x++)
|
||||
{
|
||||
qrImage.setPixel(x + 4, y + 4, ((*p & 1) ? GUIUtil::getThemedQColor(GUIUtil::ThemedColor::QR_PIXEL).rgb() : GUIUtil::getThemedQColor(GUIUtil::ThemedColor::BACKGROUND_WIDGET).rgb()));
|
||||
qrImage.setPixel(x + 3, y + 3, ((*p & 1) ? GUIUtil::getThemedQColor(GUIUtil::ThemedColor::QR_PIXEL).rgb() : GUIUtil::getThemedQColor(GUIUtil::ThemedColor::BACKGROUND_WIDGET).rgb()));
|
||||
p++;
|
||||
}
|
||||
}
|
||||
QRcode_free(code);
|
||||
|
||||
QImage qrAddrImage = QImage(QR_IMAGE_SIZE, QR_IMAGE_SIZE+20, QImage::Format_RGB32);
|
||||
qrAddrImage.fill(GUIUtil::getThemedQColor(GUIUtil::ThemedColor::BORDER_WIDGET));
|
||||
// Create the image with respect to the device pixel ratio
|
||||
int qrAddrImageWidth = QR_IMAGE_SIZE;
|
||||
int qrAddrImageHeight = QR_IMAGE_SIZE + 20;
|
||||
qreal scale = qApp->devicePixelRatio();
|
||||
QImage qrAddrImage = QImage(qrAddrImageWidth * scale, qrAddrImageHeight * scale, QImage::Format_RGB32);
|
||||
qrAddrImage.setDevicePixelRatio(scale);
|
||||
QPainter painter(&qrAddrImage);
|
||||
QRect paddedRect = qrAddrImage.rect().adjusted(1, 1, -1, -1);
|
||||
// Fill the whole image with border color
|
||||
qrAddrImage.fill(GUIUtil::getThemedQColor(GUIUtil::ThemedColor::BORDER_WIDGET));
|
||||
// Create a 2px/2px smaller rect and fill it with background color to keep the 1px border with the border color
|
||||
QRect paddedRect = QRect(1, 1, qrAddrImageWidth - 2, qrAddrImageHeight - 2);
|
||||
painter.fillRect(paddedRect, GUIUtil::getThemedQColor(GUIUtil::ThemedColor::BACKGROUND_WIDGET));
|
||||
painter.drawImage(1, 1, qrImage.scaled(QR_IMAGE_SIZE - 2, QR_IMAGE_SIZE - 2));
|
||||
QFont font = GUIUtil::fixedPitchFont();
|
||||
|
||||
painter.drawImage(2, 2, qrImage.scaled(QR_IMAGE_SIZE - 4, QR_IMAGE_SIZE - 4));
|
||||
// calculate ideal font size
|
||||
qreal font_size = GUIUtil::calculateIdealFontSize(paddedRect.width() - 20, info.address, font);
|
||||
QFont font = GUIUtil::fixedPitchFont();
|
||||
qreal font_size = GUIUtil::calculateIdealFontSize((paddedRect.width() - 20), info.address, font);
|
||||
font.setPointSizeF(font_size);
|
||||
|
||||
// paint the address
|
||||
painter.setFont(font);
|
||||
paddedRect.setHeight(QR_IMAGE_SIZE);
|
||||
painter.setPen(GUIUtil::getThemedQColor(GUIUtil::ThemedColor::QR_PIXEL));
|
||||
paddedRect.setHeight(QR_IMAGE_SIZE + 3);
|
||||
painter.drawText(paddedRect, Qt::AlignBottom|Qt::AlignCenter, info.address);
|
||||
painter.end();
|
||||
|
||||
|
@ -1482,12 +1482,6 @@ QWidget .QFrame#framePrivateSend .QWidget#layoutWidgetLastMessageAndButtons {
|
||||
max-width: 451px;
|
||||
}
|
||||
|
||||
QWidget .QFrame#framePrivateSend .QLabel#labelPrivateSendLastMessage { /* PrivateSend Status Notifications */
|
||||
qproperty-alignment: 'AlignVCenter | AlignLeft';
|
||||
min-width: 288px;
|
||||
min-height: 50px;
|
||||
}
|
||||
|
||||
QWidget .QFrame#framePrivateSend .QPushButton#togglePrivateSend { /* Start PrivateSend Mixing */
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include <QTime>
|
||||
#include <QTimer>
|
||||
#include <QStringList>
|
||||
#include <QStyledItemDelegate>
|
||||
|
||||
// TODO: add a scrollback limit, as there is currently none
|
||||
// TODO: make it possible to filter out categories (esp debug messages when implemented)
|
||||
@ -717,6 +718,9 @@ void RPCConsole::setClientModel(ClientModel *model)
|
||||
wordList << "help-console";
|
||||
wordList.sort();
|
||||
autoCompleter = new QCompleter(wordList, this);
|
||||
autoCompleter->popup()->setItemDelegate(new QStyledItemDelegate(this));
|
||||
autoCompleter->popup()->setObjectName("rpcAutoCompleter");
|
||||
GUIUtil::loadStyleSheet(autoCompleter->popup());
|
||||
autoCompleter->setModelSorting(QCompleter::CaseSensitivelySortedModel);
|
||||
ui->lineEdit->setCompleter(autoCompleter);
|
||||
autoCompleter->popup()->installEventFilter(this);
|
||||
|
@ -78,7 +78,7 @@ SendCoinsDialog::SendCoinsDialog(const PlatformStyle *_platformStyle, QWidget *p
|
||||
}, GUIUtil::FontWeight::Bold);
|
||||
|
||||
GUIUtil::setFont({ui->labelBalance,
|
||||
ui->label
|
||||
ui->labelBalanceText
|
||||
}, GUIUtil::FontWeight::Bold, 14);
|
||||
|
||||
GUIUtil::setFont({ui->labelCoinControlFeatures
|
||||
|
@ -185,11 +185,11 @@ void TestGUI()
|
||||
QString paymentText = rlist->toPlainText();
|
||||
QStringList paymentTextList = paymentText.split('\n');
|
||||
QCOMPARE(paymentTextList.at(0), QString("Payment information"));
|
||||
QVERIFY(paymentTextList.at(1).indexOf(QString("URI: dash:")) != -1);
|
||||
QVERIFY(paymentTextList.at(2).indexOf(QString("Address:")) != -1);
|
||||
QCOMPARE(paymentTextList.at(3), QString("Amount: 0.00000001 ") + BitcoinUnits::name(unit));
|
||||
QCOMPARE(paymentTextList.at(4), QString("Label: TEST_LABEL_1"));
|
||||
QCOMPARE(paymentTextList.at(5), QString("Message: TEST_MESSAGE_1"));
|
||||
QVERIFY(paymentTextList.at(2).indexOf(QString("URI: dash:")) != -1);
|
||||
QVERIFY(paymentTextList.at(3).indexOf(QString("Address:")) != -1);
|
||||
QCOMPARE(paymentTextList.at(4), QString("Amount: 0.00000001 ") + BitcoinUnits::name(unit));
|
||||
QCOMPARE(paymentTextList.at(5), QString("Label: TEST_LABEL_1"));
|
||||
QCOMPARE(paymentTextList.at(6), QString("Message: TEST_MESSAGE_1"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -79,6 +79,9 @@ void TrafficGraphWidget::paintEvent(QPaintEvent *)
|
||||
{
|
||||
QPainter painter(this);
|
||||
QRect drawRect = rect();
|
||||
// First draw the border
|
||||
painter.fillRect(drawRect, GUIUtil::getThemedQColor(GUIUtil::ThemedColor::BORDER_WIDGET));
|
||||
drawRect.adjust(1, 1, -1, -1);
|
||||
painter.fillRect(drawRect, GUIUtil::getThemedQColor(GUIUtil::ThemedColor::BACKGROUND_WIDGET));
|
||||
|
||||
if(fMax <= 0.0f) return;
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
#include <ui_interface.h>
|
||||
|
||||
#include <QCalendarWidget>
|
||||
#include <QComboBox>
|
||||
#include <QDateTimeEdit>
|
||||
#include <QDesktopServices>
|
||||
@ -33,6 +34,7 @@
|
||||
#include <QSettings>
|
||||
#include <QSignalMapper>
|
||||
#include <QTableView>
|
||||
#include <QTextCharFormat>
|
||||
#include <QTimer>
|
||||
#include <QUrl>
|
||||
#include <QVBoxLayout>
|
||||
@ -69,6 +71,7 @@ TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *pa
|
||||
instantsendWidget->addItem(tr("All"), TransactionFilterProxy::InstantSendFilter_All);
|
||||
instantsendWidget->addItem(tr("Locked by InstantSend"), TransactionFilterProxy::InstantSendFilter_Yes);
|
||||
instantsendWidget->addItem(tr("Not locked by InstantSend"), TransactionFilterProxy::InstantSendFilter_No);
|
||||
instantsendWidget->setObjectName("instantsendWidget");
|
||||
hlayout->addWidget(instantsendWidget);
|
||||
|
||||
dateWidget = new QComboBox(this);
|
||||
@ -645,9 +648,25 @@ QWidget *TransactionView::createDateRangeWidget()
|
||||
connect(dateFrom, SIGNAL(dateChanged(QDate)), this, SLOT(dateRangeChanged()));
|
||||
connect(dateTo, SIGNAL(dateChanged(QDate)), this, SLOT(dateRangeChanged()));
|
||||
|
||||
updateCalendarWidgets();
|
||||
|
||||
return dateRangeWidget;
|
||||
}
|
||||
|
||||
void TransactionView::updateCalendarWidgets()
|
||||
{
|
||||
auto adjustWeekEndColors = [](QCalendarWidget* w) {
|
||||
QTextCharFormat format = w->weekdayTextFormat(Qt::Saturday);
|
||||
format.setForeground(QBrush(GUIUtil::getThemedQColor(GUIUtil::ThemedColor::DEFAULT), Qt::SolidPattern));
|
||||
|
||||
w->setWeekdayTextFormat(Qt::Saturday, format);
|
||||
w->setWeekdayTextFormat(Qt::Sunday, format);
|
||||
};
|
||||
|
||||
adjustWeekEndColors(dateFrom->calendarWidget());
|
||||
adjustWeekEndColors(dateTo->calendarWidget());
|
||||
}
|
||||
|
||||
void TransactionView::dateRangeChanged()
|
||||
{
|
||||
if(!transactionProxyModel)
|
||||
@ -709,6 +728,13 @@ void TransactionView::resizeEvent(QResizeEvent* event)
|
||||
columnResizingFixer->stretchColumnWidth(TransactionTableModel::ToAddress);
|
||||
}
|
||||
|
||||
void TransactionView::changeEvent(QEvent* e)
|
||||
{
|
||||
if (e->type() == QEvent::StyleChange) {
|
||||
updateCalendarWidgets();
|
||||
}
|
||||
}
|
||||
|
||||
// Need to override default Ctrl+C action for amount as default behaviour is just to copy DisplayRole text
|
||||
bool TransactionView::eventFilter(QObject *obj, QEvent *event)
|
||||
{
|
||||
@ -721,6 +747,14 @@ bool TransactionView::eventFilter(QObject *obj, QEvent *event)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (event->type() == QEvent::Show) {
|
||||
// Give the search field the first focus on startup
|
||||
static bool fGotFirstFocus = false;
|
||||
if (!fGotFirstFocus) {
|
||||
search_widget->setFocus();
|
||||
fGotFirstFocus = true;
|
||||
}
|
||||
}
|
||||
return QWidget::eventFilter(obj, event);
|
||||
}
|
||||
|
||||
|
@ -82,10 +82,12 @@ private:
|
||||
QAction *abandonAction;
|
||||
|
||||
QWidget *createDateRangeWidget();
|
||||
void updateCalendarWidgets();
|
||||
|
||||
GUIUtil::TableViewLastColumnResizingFixer *columnResizingFixer;
|
||||
|
||||
virtual void resizeEvent(QResizeEvent* event) override;
|
||||
void changeEvent(QEvent* e) override;
|
||||
|
||||
bool eventFilter(QObject *obj, QEvent *event) override;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user