Skip to content

Commit

Permalink
Adjust TimerDialog's size to content's size
Browse files Browse the repository at this point in the history
  • Loading branch information
hermit4 committed Nov 4, 2013
1 parent 4a72f7f commit 8fa8674
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 14 deletions.
5 changes: 5 additions & 0 deletions timerdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@
#include "../KanmusuMemoryTwitter/twitterinfo.h"

#include <QQmlContext>
#include <QQuickItem>
#include <QtQml/QQmlEngine>
#include <QDateTime>

#include <QtCore/QDebug>

static const int DIALOG_MARGIN = 30;

TimerDialog::TimerDialog(QWidget *parent
, QSystemTrayIcon *trayIcon
Expand Down Expand Up @@ -76,6 +78,9 @@ void TimerDialog::showEvent(QShowEvent *event)
//QML設定して表示
m_viewer->setSource(QUrl("qrc:///qml/KanmusuMemory/timerDialog.qml"));
m_viewer->show();
QSize contentSize = m_viewer->rootObject()->childrenRect().toRect().size() + QSize(DIALOG_MARGIN,DIALOG_MARGIN);
setMinimumSize(contentSize);
setMaximumSize(contentSize);
}
}

Expand Down
4 changes: 2 additions & 2 deletions timerdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ public slots:
void timeout();

private:
Ui::TimerDialog *ui;

QtQuick2ApplicationViewer *m_viewer;
TimerData m_timerdata;
QTimer m_timer;
Expand All @@ -61,6 +59,8 @@ public slots:
OAuth m_oauth;
Status m_status;

Ui::TimerDialog *ui;

bool checkKanmemoTimerTimeout(qint64 settime, qint64 starttime);
void showTimerMessage(const QStringList &messages);
void tweetTimerMessage(const QStringList &messages);
Expand Down
12 changes: 0 additions & 12 deletions timerdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,6 @@
<height>620</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>350</width>
<height>620</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>350</width>
<height>620</height>
</size>
</property>
<property name="windowTitle">
<string>Timer</string>
</property>
Expand Down

0 comments on commit 8fa8674

Please sign in to comment.