diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index bad8afeb82..b07dbbfe66 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -510,7 +510,7 @@ void BitcoinGUI::createToolBars() { if(walletFrame) { - QToolBar *toolbar = addToolBar(tr("Tabs toolbar")); + toolbar = addToolBar(tr("Tabs toolbar")); toolbar->setContextMenuPolicy(Qt::PreventContextMenu); toolbar->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); toolbar->setToolButtonStyle(Qt::ToolButtonTextOnly); @@ -523,7 +523,7 @@ void BitcoinGUI::createToolBars() toolbar->addAction(lelantusAction); toolbar->addAction(masternodeAction); - QLabel *logoLabel = new QLabel(); + logoLabel = new QLabel(); logoLabel->setObjectName("lblToolbarLogo"); logoLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); @@ -1474,3 +1474,26 @@ void UnitDisplayStatusBarControl::onMenuSelection(QAction* action) optionsModel->setDisplayUnit(action->data()); } } + +// Handles resize events for the BitcoinGUI widget by adjusting internal component sizes. +void BitcoinGUI::resizeEvent(QResizeEvent* event) { + QMainWindow::resizeEvent(event); + + // Retrieve new dimensions from the resize event + int newWidth = event->size().width(); + int newHeight = event->size().height(); + int actionWidth = newWidth / 6; + + // Set widths for each action dynamically + QWidget* overviewWidget = toolbar->widgetForAction(overviewAction); + QWidget* receiveWidget = toolbar->widgetForAction(receiveCoinsAction); + QWidget* historyWidget = toolbar->widgetForAction(historyAction); + QWidget* sendCoinsWidget = toolbar->widgetForAction(sendCoinsAction); + QWidget* masternodeWidget = toolbar->widgetForAction(masternodeAction); + + overviewWidget->setMinimumWidth(actionWidth); + receiveWidget->setMinimumWidth(actionWidth); + historyWidget->setMinimumWidth(actionWidth); + sendCoinsWidget->setMinimumWidth(actionWidth); + masternodeWidget->setMinimumWidth(actionWidth); +} \ No newline at end of file diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h index a2e6b1c5fd..bb2db20668 100644 --- a/src/qt/bitcoingui.h +++ b/src/qt/bitcoingui.h @@ -17,6 +17,8 @@ #include #include #include +#include +#include class ClientModel; class NetworkStyle; @@ -121,7 +123,8 @@ class BitcoinGUI : public QMainWindow QAction *lelantusAction; QAction *masternodeAction; QAction *logoAction; - + QToolBar *toolbar; + QLabel *logoLabel; QSystemTrayIcon *trayIcon; QMenu *trayIconMenu; Notificator *notificator; @@ -141,6 +144,7 @@ class BitcoinGUI : public QMainWindow void createMenuBar(); /** Create the toolbars */ void createToolBars(); + void resizeEvent(QResizeEvent*); /** Create system tray icon and notification */ void createTrayIcon(const NetworkStyle *networkStyle); /** Create system tray menu (or setup the dock menu) */ diff --git a/src/qt/masternodelist.cpp b/src/qt/masternodelist.cpp index a5b5e399e0..906b924326 100644 --- a/src/qt/masternodelist.cpp +++ b/src/qt/masternodelist.cpp @@ -367,3 +367,48 @@ void MasternodeList::copyCollateralOutpoint_clicked() QApplication::clipboard()->setText(QString::fromStdString(dmn->collateralOutpoint.ToStringShort())); } + +void MasternodeList::resizeEvent(QResizeEvent* event) +{ + QWidget::resizeEvent(event); + + const int newWidth = event->size().width(); + const int newHeight = event->size().height(); + + adjustTextSize(newWidth ,newHeight); + + // Calculate new column widths based on the new window width + int newWidthOwner = static_cast(newWidth * 0.19); + int newWidthMin = static_cast(newWidth * 0.08); + int newWidthMid = static_cast(newWidth * 0.12); + int newWidthStatus = static_cast(newWidth * 0.11); + + // Apply new column widths + ui->tableWidgetMasternodesDIP3->setColumnWidth(0, newWidthStatus); + ui->tableWidgetMasternodesDIP3->setColumnWidth(1, newWidthMin); + ui->tableWidgetMasternodesDIP3->setColumnWidth(2, newWidthMin); + ui->tableWidgetMasternodesDIP3->setColumnWidth(3, newWidthMid); + ui->tableWidgetMasternodesDIP3->setColumnWidth(4, newWidthMid); + ui->tableWidgetMasternodesDIP3->setColumnWidth(5, newWidthMid); + ui->tableWidgetMasternodesDIP3->setColumnWidth(6, newWidthMid); + ui->tableWidgetMasternodesDIP3->setColumnWidth(7, newWidthMid); + ui->tableWidgetMasternodesDIP3->setColumnWidth(8, newWidthMid); + ui->tableWidgetMasternodesDIP3->setColumnWidth(9, newWidthOwner); +} +void MasternodeList::adjustTextSize(int width,int height){ + + const double fontSizeScalingFactor = 70.0; + int baseFontSize = std::min(width, height) / fontSizeScalingFactor; + int fontSize = std::min(15, std::max(12, baseFontSize)); + QFont font = this->font(); + font.setPointSize(fontSize); + + // Set font size for all labels + ui->label_filter_2->setFont(font); + ui->label_count_2->setFont(font); + ui->countLabelDIP3->setFont(font); + ui->checkBoxMyMasternodesOnly->setFont(font); + ui->tableWidgetMasternodesDIP3->setFont(font); + ui->tableWidgetMasternodesDIP3->horizontalHeader()->setFont(font); + ui->tableWidgetMasternodesDIP3->verticalHeader()->setFont(font); +} \ No newline at end of file diff --git a/src/qt/masternodelist.h b/src/qt/masternodelist.h index 58fec5d426..6d469ea9be 100644 --- a/src/qt/masternodelist.h +++ b/src/qt/masternodelist.h @@ -11,6 +11,7 @@ #include #include #include +#include #define MASTERNODELIST_UPDATE_SECONDS 3 #define MASTERNODELIST_FILTER_COOLDOWN_SECONDS 3 @@ -38,7 +39,8 @@ class MasternodeList : public QWidget void setClientModel(ClientModel* clientModel); void setWalletModel(WalletModel* walletModel); - + void resizeEvent(QResizeEvent*) override; + void adjustTextSize(int width,int height); private: QMenu* contextMenuDIP3; int64_t nTimeFilterUpdatedDIP3; diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp index 1ca4791c45..507f7f604d 100644 --- a/src/qt/overviewpage.cpp +++ b/src/qt/overviewpage.cpp @@ -497,4 +497,104 @@ void MigrateLelantusToSparkDialog::onMigrateClicked() bool MigrateLelantusToSparkDialog::getClickedButton() { return clickedButton; +} +void OverviewPage::resizeEvent(QResizeEvent* event) +{ + QWidget::resizeEvent(event); + + // Retrieve new dimensions from the resize event + const int newWidth = event->size().width(); + const int newHeight = event->size().height(); + adjustTextSize(newWidth, newHeight); + + // Determine widths for specific widgets as percentages of total width + int labelWidth = static_cast(newWidth * 0.5); + int labelMinWidth = static_cast(newWidth * 0.15); + int labelMaxWidth = static_cast(newWidth * 0.35); + const int labelHeight = 20; + + // Configure the dimensions and constraints of each widget + ui->labelBalance->setFixedWidth(labelWidth); + ui->labelBalance->setMinimumWidth(labelMinWidth); + ui->labelBalance->setMaximumWidth(labelMaxWidth); + ui->labelBalance->setFixedHeight(labelHeight); + + ui->labelUnconfirmed->setFixedWidth(labelWidth); + ui->labelUnconfirmed->setMinimumWidth(labelMinWidth); + ui->labelUnconfirmed->setMaximumWidth(labelMaxWidth); + ui->labelUnconfirmed->setFixedHeight(labelHeight); + + int buttonWidth = static_cast(newWidth * 0.15); + int buttonHeight = static_cast(newHeight * 0.05); + int buttonMinHeight = static_cast(20); + int buttonMaxHeight = static_cast(45); + + ui->anonymizeButton->setMinimumWidth(buttonWidth); + ui->anonymizeButton->setMaximumWidth(buttonWidth * 2); + ui->anonymizeButton->setMinimumHeight(buttonMinHeight); + ui->anonymizeButton->setMaximumHeight(buttonMaxHeight); + + // Set the minimum width for all label widgets to ensure they maintain a consistent and readable size regardless of window resizing + ui->labelAnonymizable->setMinimumWidth(labelMinWidth); + ui->labelAlerts->setMinimumWidth(labelMinWidth); + ui->label->setMinimumWidth(labelMinWidth); + ui->labelWatchPending->setMinimumWidth(labelMinWidth); + ui->labelBalance->setMinimumWidth(labelMinWidth); + ui->labelSpendable->setMinimumWidth(labelMinWidth); + ui->labelWatchAvailable->setMinimumWidth(labelMinWidth); + ui->labelUnconfirmedPrivate->setMinimumWidth(labelMinWidth); + ui->labelWatchonly->setMinimumWidth(labelMinWidth); + ui->labelTotal->setMinimumWidth(labelMinWidth); + ui->labelWatchTotal->setMinimumWidth(labelMinWidth); + ui->labelUnconfirmed->setMinimumWidth(labelMinWidth); + ui->labelImmature->setMinimumWidth(labelMinWidth); + ui->labelPrivate->setMinimumWidth(labelMinWidth); + ui->label_4->setMinimumWidth(labelMinWidth); +} +void OverviewPage::adjustTextSize(int width, int height){ + + const double fontSizeScalingFactor = 133.0; + int baseFontSize = width / fontSizeScalingFactor; + int fontSize = std::min(15, std::max(12, baseFontSize)); + + // Font for regular text components(not bold) + QFont textFont = ui->labelBalance->font(); + textFont.setPointSize(fontSize); + textFont.setBold(false); + + // Font for text components that should be bold + QFont labelFont = textFont; + labelFont.setBold(true); + + ui->textWarning1->setFont(textFont); + ui->textWarning2->setFont(textFont); + ui->labelWalletStatus->setFont(textFont); + ui->anonymizeButton->setFont(textFont); + + // Apply label font to all label components + ui->labelAlerts->setFont(labelFont); + ui->label_5->setFont(labelFont); + ui->labelAnonymizableText->setFont(textFont); + ui->label->setFont(labelFont); + ui->labelAnonymizable->setFont(labelFont); + ui->labelWatchPending->setFont(labelFont); + ui->labelBalance->setFont(labelFont); + ui->labelSpendable->setFont(labelFont); + ui->labelWatchAvailable->setFont(labelFont); + ui->labelPendingText->setFont(textFont); + ui->labelUnconfirmedPrivate->setFont(labelFont); + ui->labelUnconfirmedPrivateText->setFont(textFont); + ui->labelTotalText->setFont(textFont); + ui->labelWatchonly->setFont(labelFont); + ui->labelBalanceText->setFont(textFont); + ui->labelTotal->setFont(labelFont); + ui->labelWatchTotal->setFont(labelFont); + ui->labelUnconfirmed->setFont(labelFont); + ui->labelImmatureText->setFont(textFont); + ui->labelImmature->setFont(labelFont); + ui->labelWatchImmature->setFont(labelFont); + ui->labelPrivateText->setFont(textFont); + ui->labelPrivate->setFont(labelFont); + ui->label_4->setFont(labelFont); + } \ No newline at end of file diff --git a/src/qt/overviewpage.h b/src/qt/overviewpage.h index 84549f2b74..53a75aa594 100644 --- a/src/qt/overviewpage.h +++ b/src/qt/overviewpage.h @@ -16,6 +16,8 @@ #include #include #include +#include + class ClientModel; class TransactionFilterProxy; @@ -44,6 +46,7 @@ class OverviewPage : public QWidget void setWalletModel(WalletModel *walletModel); void showOutOfSyncWarning(bool fShow); void UpdatePropertyBalance(unsigned int propertyId, uint64_t available, uint64_t reserved); + void resizeEvent(QResizeEvent* event) override; public Q_SLOTS: void on_anonymizeButton_clicked(); @@ -89,7 +92,7 @@ public Q_SLOTS: QString migrationWindowClosesIn; QString blocksRemaining; QString migrateAmount; - + void adjustTextSize(int width,int height); private Q_SLOTS: void updateDisplayUnit(); void handleTransactionClicked(const QModelIndex &index); diff --git a/src/qt/receivecoinsdialog.cpp b/src/qt/receivecoinsdialog.cpp index 963a11f4dd..21b9352591 100644 --- a/src/qt/receivecoinsdialog.cpp +++ b/src/qt/receivecoinsdialog.cpp @@ -24,6 +24,7 @@ #include #include #include +#include ReceiveCoinsDialog::ReceiveCoinsDialog(const PlatformStyle *_platformStyle, QWidget *parent) : QDialog(parent), @@ -360,4 +361,98 @@ void RecentRequestsFilterProxy::setTypeFilter(quint32 modes) { this->typeFilter = modes; invalidateFilter(); +} + +// Handles resize events for the ReceiveCoinsDialog widget by adjusting internal component sizes. +void ReceiveCoinsDialog::resizeEvent(QResizeEvent* event) +{ + QDialog::resizeEvent(event); + + // Get new size from the event + const int newWidth = event->size().width(); + const int newHeight = event->size().height(); + + adjustTextSize(newWidth,newHeight); + // Set fixed, minimum, and maximum sizes for ComboBoxes + int comboBoxMinHeight = 20; + int comboBoxMaxHeight = 40; + int comboBoxWidth = newWidth * 0.08; + int comboBoxMinWidth = newWidth * 0.05; + int comboBoxMaxWidth = newWidth * 0.1; + + ui->addressTypeCombobox->setMinimumWidth(comboBoxMinWidth); + ui->addressTypeCombobox->setMaximumWidth(comboBoxMaxWidth); + ui->addressTypeCombobox->setMinimumHeight(comboBoxMinHeight); + ui->addressTypeCombobox->setMaximumHeight(comboBoxMaxHeight); + + ui->addressTypeHistoryCombobox->setMinimumWidth(comboBoxMinWidth); + ui->addressTypeHistoryCombobox->setMaximumWidth(comboBoxMaxWidth); + ui->addressTypeHistoryCombobox->setMinimumHeight(comboBoxMinHeight); + ui->addressTypeHistoryCombobox->setMaximumHeight(comboBoxMaxHeight); + + // Set sizes for buttons dynamically + int buttonMinHeight = 20; + int buttonMaxHeight = 35; + int buttonWidth = newWidth * 0.15; + int buttonMinWidth = newWidth * 0.1; + int buttonMaxWidth = newWidth * 0.4; + + ui->clearButton->setMinimumWidth(buttonMinWidth); + ui->clearButton->setMaximumWidth(buttonMaxWidth); + ui->clearButton->setMinimumHeight(buttonMinHeight); + ui->clearButton->setMaximumHeight(buttonMaxHeight); + + ui->receiveButton->setMinimumWidth(buttonMinWidth); + ui->receiveButton->setMaximumWidth(buttonMaxWidth); + ui->receiveButton->setMinimumHeight(buttonMinHeight); + ui->receiveButton->setMaximumHeight(buttonMaxHeight); + + ui->showRequestButton->setMinimumWidth(buttonMinWidth); + ui->showRequestButton->setMaximumWidth(buttonMaxWidth); + ui->showRequestButton->setMinimumHeight(buttonMinHeight); + ui->showRequestButton->setMaximumHeight(buttonMaxHeight); + + ui->removeRequestButton->setMinimumWidth(buttonMinWidth); + ui->removeRequestButton->setMaximumWidth(buttonMaxWidth); + ui->removeRequestButton->setMinimumHeight(buttonMinHeight); + ui->removeRequestButton->setMaximumHeight(buttonMaxHeight); + + // Adjust column widths proportionally + int dateColumnWidth = newWidth * 0.25; + int labelColumnWidth = newWidth * 0.25; + int addressTypeColumnWidth = newWidth * 0.25; + int amountColumnWidth = newWidth * 0.25; + + ui->recentRequestsView->setColumnWidth(RecentRequestsTableModel::Date, dateColumnWidth); + ui->recentRequestsView->setColumnWidth(RecentRequestsTableModel::Label, labelColumnWidth); + ui->recentRequestsView->setColumnWidth(RecentRequestsTableModel::AddressType, addressTypeColumnWidth); + ui->recentRequestsView->setColumnWidth(RecentRequestsTableModel::Amount, amountColumnWidth); +} +void ReceiveCoinsDialog::adjustTextSize(int width,int height){ + + const double fontSizeScalingFactor = 70.0; + int baseFontSize = std::min(width, height) / fontSizeScalingFactor; + int fontSize = std::min(15, std::max(12, baseFontSize)); + QFont font = this->font(); + font.setPointSize(fontSize); + + // Set font size for all labels + ui->reuseAddress->setFont(font); + ui->label_4->setFont(font); + ui->label_3->setFont(font); + ui->addressTypeLabel->setFont(font); + ui->label_5->setFont(font); + ui->label_2->setFont(font); + ui->label->setFont(font); + ui->label_7->setFont(font); + ui->label_6->setFont(font); + ui->receiveButton->setFont(font); + ui->clearButton->setFont(font); + ui->showRequestButton->setFont(font); + ui->removeRequestButton->setFont(font); + ui->addressTypeCombobox->setFont(font); + ui->addressTypeHistoryCombobox->setFont(font); + ui->recentRequestsView->setFont(font); + ui->recentRequestsView->horizontalHeader()->setFont(font); + ui->recentRequestsView->verticalHeader()->setFont(font); } \ No newline at end of file diff --git a/src/qt/receivecoinsdialog.h b/src/qt/receivecoinsdialog.h index 47dc5e992a..c5eac0b986 100644 --- a/src/qt/receivecoinsdialog.h +++ b/src/qt/receivecoinsdialog.h @@ -15,6 +15,7 @@ #include #include #include +#include class OptionsModel; class PlatformStyle; @@ -57,7 +58,8 @@ class ReceiveCoinsDialog : public QDialog ~ReceiveCoinsDialog(); void setModel(WalletModel *model); - + + void resizeEvent(QResizeEvent* event) override; public Q_SLOTS: void clear(); void reject(); @@ -77,7 +79,7 @@ public Q_SLOTS: QModelIndex selectedRow(); void copyColumnToClipboard(int column); RecentRequestsFilterProxy *recentRequestsProxyModel; - + void adjustTextSize(int width,int height); private Q_SLOTS: void on_receiveButton_clicked(); void on_showRequestButton_clicked(); diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index 66b380fea5..26cbf138e5 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -1403,4 +1403,88 @@ void SendGoPrivateDialog::onGoPrivateClicked() bool SendGoPrivateDialog::getClickedButton() { return clickedButton; -} \ No newline at end of file +} +void SendCoinsDialog::resizeEvent(QResizeEvent* event) { + QWidget::resizeEvent(event); + + // Retrieve new dimensions from the resize event + const int newWidth = event->size().width(); + const int newHeight = event->size().height(); + + const int labelMinWidth = static_cast(newWidth * 0.15); + + // Resize and adjust components + ui->sendButton->setMinimumWidth(labelMinWidth); + ui->clearButton->setMinimumWidth(labelMinWidth); + ui->addButton->setMinimumWidth(labelMinWidth); + ui->buttonChooseFee->setMinimumWidth(labelMinWidth); + ui->buttonMinimizeFee->setMinimumWidth(labelMinWidth); + ui->switchFundButton->setMinimumWidth(labelMinWidth); + ui->pushButtonCoinControl->setMinimumWidth(labelMinWidth); + + + // Dynamically adjust text sizes based on the new dimensions + adjustTextSize(newWidth, newHeight); +} + +void SendCoinsDialog::adjustTextSize(int width, int height) { + const double fontSizeScalingFactor = 131.3; + int baseFontSize = width / fontSizeScalingFactor; + int fontSize = std::min(15, std::max(12, baseFontSize)); + + QFont font = ui->labelBalance->font(); + font.setPointSize(fontSize); + + QFont textFont = font; + textFont.setBold(true); + + // Set font size for all labels + ui->labelBalance->setFont(font); + ui->lineEditCoinControlChange->setFont(font); + ui->labelFeeEstimation->setFont(font); + ui->labelFeeHeadline->setFont(font); + ui->labelCoinControlFeatures->setFont(textFont); + ui->labelCoinControlAutomaticallySelected->setFont(font); + ui->labelCoinControlInsuffFunds->setFont(font); + ui->labelCoinControlQuantity->setFont(font); + ui->labelCoinControlBytes->setFont(font); + ui->labelCoinControlAmount->setFont(font); + ui->labelCoinControlLowOutput->setFont(font); + ui->labelCoinControlFee->setFont(font); + ui->labelCoinControlAfterFee->setFont(font); + ui->labelCoinControlChange->setFont(font); + ui->labelFeeMinimized->setFont(font); + ui->labelBalance->setFont(font); + ui->radioSmartFee->setFont(font); + ui->radioCustomPerKilobyte->setFont(font); + ui->radioCustomFee->setFont(font); + ui->radioCustomAtLeast->setFont(font); + ui->labelBalanceText->setFont(font); + ui->labelFeeEstimation->setFont(font); + ui->labelSmartFee->setFont(font); + ui->labelSmartFee2->setFont(font); + ui->labelSmartFee3->setFont(font); + ui->labelSmartFeeNormal->setFont(font); + ui->labelSmartFeeFast->setFont(font); + ui->labelCoinControlQuantityText->setFont(font); + ui->labelCoinControlBytesText->setFont(font); + ui->labelCoinControlAmountText->setFont(font); + ui->labelCoinControlLowOutputText->setFont(font); + ui->labelCoinControlFeeText->setFont(font); + ui->labelCoinControlAfterFeeText->setFont(font); + ui->labelCoinControlChangeText->setFont(font); + ui->labelCoinControlChangeLabel->setFont(font); + ui->labelMinFeeWarning->setFont(font); + ui->fallbackFeeWarningLabel->setFont(font); + ui->checkBoxMinimumFee->setFont(font); + ui->checkBoxCoinControlChange->setFont(font); + ui->confirmationTargetLabel->setFont(font); + + + // Adjust font for all buttons + ui->sendButton->setFont(font); + ui->clearButton->setFont(font); + ui->addButton->setFont(font); + ui->pushButtonCoinControl->setFont(font); + ui->customFee->setFont(font); +} diff --git a/src/qt/sendcoinsdialog.h b/src/qt/sendcoinsdialog.h index 7656627a55..5abf2e3a07 100644 --- a/src/qt/sendcoinsdialog.h +++ b/src/qt/sendcoinsdialog.h @@ -67,6 +67,8 @@ public Q_SLOTS: bool fFeeMinimized; bool fAnonymousMode; const PlatformStyle *platformStyle; + void resizeEvent(QResizeEvent* event) override; + void adjustTextSize(int width, int height); // Process WalletModel::SendCoinsReturn and generate a pair consisting // of a message and message flags for use in Q_EMIT message(). @@ -125,6 +127,7 @@ private Q_SLOTS: QAbstractButton *yesButton; QTimer countDownTimer; int secDelay; + }; class SendGoPrivateDialog : public QMessageBox diff --git a/src/qt/sendcoinsentry.cpp b/src/qt/sendcoinsentry.cpp index 49fda59920..eb2d7e62dc 100644 --- a/src/qt/sendcoinsentry.cpp +++ b/src/qt/sendcoinsentry.cpp @@ -14,6 +14,7 @@ #include #include +#include SendCoinsEntry::SendCoinsEntry(const PlatformStyle *_platformStyle, QWidget *parent) : QStackedWidget(parent), @@ -265,3 +266,41 @@ bool SendCoinsEntry::updateLabel(const QString &address) ui->addAsLabel->setText(associatedLabel); return true; } +void SendCoinsEntry::resizeEvent(QResizeEvent* event) { + QStackedWidget::resizeEvent(event); + + const int newWidth = event->size().width(); + const int newHeight = event->size().height(); + + adjustTextSize(newWidth, newHeight); +} + + +void SendCoinsEntry::adjustTextSize(int width, int height) { + const double fontSizeScalingFactor = 130.0; + int baseFontSize = width / fontSizeScalingFactor; + int fontSize = std::max(12,baseFontSize); + QFont font = this->font(); + font.setPointSize(fontSize); + + ui->payToLabel->setFont(font); + ui->labellLabel->setFont(font); + ui->addAsLabel->setFont(font); + ui->amountLabel->setFont(font); + ui->messageLabel->setFont(font); + ui->messageTextLabel->setFont(font); + ui->payTo->setFont(font); + ui->payTo_is->setFont(font); + ui->memoLabel_is->setFont(font); + ui->memoTextLabel_is->setFont(font); + ui->amountLabel_is->setFont(font); + ui->payToLabel_s->setFont(font); + ui->payTo_s->setFont(font); + ui->memoLabel_s->setFont(font); + ui->memoTextLabel_s->setFont(font); + ui->amountLabel_s->setFont(font); + ui->checkboxSubtractFeeFromAmount->setFont(font); + ui->deleteButton->setFont(font); + ui->pasteButton->setFont(font); + ui->addressBookButton->setFont(font); +} \ No newline at end of file diff --git a/src/qt/sendcoinsentry.h b/src/qt/sendcoinsentry.h index 2c6bf35242..506981d5e3 100644 --- a/src/qt/sendcoinsentry.h +++ b/src/qt/sendcoinsentry.h @@ -73,6 +73,9 @@ private Q_SLOTS: bool isPcodeEntry; bool updateLabel(const QString &address); + void resizeEvent(QResizeEvent* event) override; + void adjustTextSize(int width, int height); + }; #endif // BITCOIN_QT_SENDCOINSENTRY_H diff --git a/src/qt/transactionview.cpp b/src/qt/transactionview.cpp index bbd3e4b049..7ad14a9ac5 100644 --- a/src/qt/transactionview.cpp +++ b/src/qt/transactionview.cpp @@ -67,7 +67,6 @@ TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *pa headerLayout->addWidget(watchOnlyWidget); instantsendWidget = new QComboBox(this); - instantsendWidget->setFixedWidth(150); 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); @@ -711,3 +710,64 @@ void TransactionView::updateWatchOnlyColumn(bool fHaveWatchOnly) watchOnlyWidget->setVisible(fHaveWatchOnly); transactionView->setColumnHidden(TransactionTableModel::Watchonly, !fHaveWatchOnly); } + +// Handles resize events for the TransactionView widget by adjusting internal component sizes. +void TransactionView::resizeEvent(QResizeEvent* event) +{ + QWidget::resizeEvent(event); + + // Retrieve new dimensions from the resize event + const int newWidth = event->size().width(); + const int newHeight = event->size().height(); + + adjustTextSize(newWidth, newHeight); + + int headerHeight = newHeight * 0.1; + + // Calculate the height of widgets in the header subtracting a small margin + int widgetHeight = headerHeight - 5; + + // Determine widths for specific widgets as percentages of total width + int comboBoxesWidgetWidth = newWidth * 0.10; + int addressWidgetWidth = newWidth * 0.25; + + dateWidget->setFixedWidth(comboBoxesWidgetWidth); + typeWidget->setFixedWidth(comboBoxesWidgetWidth); + amountWidget->setFixedWidth(comboBoxesWidgetWidth); + instantsendWidget->setFixedWidth(comboBoxesWidgetWidth); + + int tableViewHeight = newHeight - headerHeight; + + // Calculate and set column widths based on new width, keeping proportions + int statusColumnWidth = newWidth * 0.05; + int watchOnlyColumnWidth = newWidth * 0.05; + int instantSendColumnWidth = newWidth * 0.05; + int dateColumnWidth = newWidth * 0.08; + int typeColumnWidth = newWidth * 0.10; + int addressColumnWidth = newWidth * 0.25; + + transactionView->setColumnWidth(TransactionTableModel::Status, statusColumnWidth); + transactionView->setColumnWidth(TransactionTableModel::Watchonly, watchOnlyColumnWidth); + transactionView->setColumnWidth(TransactionTableModel::InstantSend, instantSendColumnWidth); + transactionView->setColumnWidth(TransactionTableModel::Date, dateColumnWidth); + transactionView->setColumnWidth(TransactionTableModel::Type, typeColumnWidth); + transactionView->setColumnWidth(TransactionTableModel::ToAddress, addressColumnWidth); +} +void TransactionView::adjustTextSize(int width,int height){ + + const double fontSizeScalingFactor = 65.0; + int baseFontSize = std::min(width, height) / fontSizeScalingFactor; + int fontSize = std::min(15, std::max(12, baseFontSize)); + QFont font = this->font(); + font.setPointSize(fontSize); + + // Set font size for all labels + transactionView->setFont(font); + transactionView->horizontalHeader()->setFont(font); + transactionView->verticalHeader()->setFont(font); + dateWidget->setFont(font); + typeWidget->setFont(font); + amountWidget->setFont(font); + instantsendWidget->setFont(font); + addressWidget->setFont(font); +} \ No newline at end of file diff --git a/src/qt/transactionview.h b/src/qt/transactionview.h index fcebafc0ea..5b78cce3f7 100644 --- a/src/qt/transactionview.h +++ b/src/qt/transactionview.h @@ -9,6 +9,7 @@ #include #include +#include class PlatformStyle; class TransactionFilterProxy; @@ -37,6 +38,8 @@ class TransactionView : public QWidget explicit TransactionView(const PlatformStyle *platformStyle, QWidget *parent = 0); void setModel(WalletModel *model); + void resizeEvent(QResizeEvent* event) override; + void adjustTextSize(int width, int height); // Date ranges for filter enum DateEnum