Skip to content

Commit

Permalink
185/remove about button and convert the svg logo to a clickable widget
Browse files Browse the repository at this point in the history
  • Loading branch information
mikelloc authored and trufae committed Sep 6, 2024
1 parent 1b62051 commit a5eea41
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 49 deletions.
1 change: 1 addition & 0 deletions src/Iaito.pro
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,7 @@ HEADERS += \
core/IaitoDescriptions.h \
dialogs/EditStringDialog.h \
dialogs/WriteCommandsDialogs.h \
widgets/ClickableSvgWidget.h \
widgets/DisassemblerGraphView.h \
widgets/OverviewView.h \
common/RichTextPainter.h \
Expand Down
3 changes: 3 additions & 0 deletions src/dialogs/NewFileDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ NewFileDialog::NewFileDialog(MainWindow *main) :
fillIOPluginsList();
fillProjectsList();

connect(ui->logoSvgWidget, SIGNAL(clicked()), this, SLOT(on_aboutButton_clicked()));
ui->logoSvgWidget->setToolTip(tr("About Iaito"));

// Set last clicked tab
ui->tabWidget->setCurrentIndex(Config()->getNewFileLastClicked());

Expand Down
1 change: 1 addition & 0 deletions src/dialogs/NewFileDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <QListWidgetItem>
#include <QSpacerItem>
#include <memory>
#include "../widgets/ClickableSvgWidget.h"

namespace Ui {
class NewFileDialog;
Expand Down
52 changes: 3 additions & 49 deletions src/dialogs/NewFileDialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<number>2</number>
</property>
<item alignment="Qt::AlignmentFlag::AlignHCenter">
<widget class="QSvgWidget" name="logoSvgWidget" native="true">
<widget class="ClickableSvgWidget" name="logoSvgWidget" native="true">
<property name="minimumSize">
<size>
<width>88</width>
Expand All @@ -52,52 +52,6 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="buttonBar" stretch="0,0,0">
<property name="spacing">
<number>10</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>500</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="aboutButton">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="text">
<string>About</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>500</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="spacing">
Expand Down Expand Up @@ -525,9 +479,9 @@
</widget>
<customwidgets>
<customwidget>
<class>QSvgWidget</class>
<class>ClickableSvgWidget</class>
<extends>QWidget</extends>
<header>QSvgWidget</header>
<header>ClickableSvgWidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
Expand Down
27 changes: 27 additions & 0 deletions src/widgets/ClickableSvgWidget.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#ifndef CLICKABLESVGWIDGET_H
#define CLICKABLESVGWIDGET_H

#include <QSvgWidget>
#include <QMouseEvent>

class ClickableSvgWidget : public QSvgWidget {
Q_OBJECT

public:
explicit ClickableSvgWidget(QWidget *parent = nullptr)
: QSvgWidget(parent) {}

signals:
void clicked();

protected:
void mousePressEvent(QMouseEvent *event) override {
if (event->button() == Qt::LeftButton) {
emit clicked();
}
// Call the base class implementation to ensure proper event handling
QSvgWidget::mousePressEvent(event);
}
};

#endif // CLICKABLESVGWIDGET_H

0 comments on commit a5eea41

Please sign in to comment.