|
From: Tapio V. <aa...@us...> - 2011-01-05 14:10:58
|
Module: editor
Branch: master
Commit: 8e666ba1f02ebf84503c5bd0904f221e43d299cc
Author: Tapio Vierros <tap...@gm...>
Date: Wed Jan 5 16:09:40 2011 +0200
Load window from qtdesigner's .ui file (rather b0rked atm though).
---
CMakeLists.txt | 1 +
editor.ui | 172 ++++++++++++++++++++++++++++++++++++++++++++++++++++
main.cc | 11 +++-
notegraphwidget.cc | 4 -
4 files changed, 181 insertions(+), 7 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 361556d..a27e03a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -27,6 +27,7 @@ QT4_WRAP_UI(UI_SOURCES ${UI_FILES} )
QT4_AUTOMOC(MOC_SOURCES ${SOURCE_FILES})
include_directories(${CMAKE_BINARY_DIR})
+include_directories(${CMAKE_SOURCE_DIR})
add_executable(editor ${SOURCE_FILES} ${MOC_SOURCES} ${RESOURCE_SOURCES} ${UI_SOURCES})
target_link_libraries(editor ${QT_LIBRARIES})
diff --git a/editor.ui b/editor.ui
new file mode 100644
index 0000000..085d819
--- /dev/null
+++ b/editor.ui
@@ -0,0 +1,172 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>800</width>
+ <height>600</height>
+ </rect>
+ </property>
+ <property name="contextMenuPolicy">
+ <enum>Qt::DefaultContextMenu</enum>
+ </property>
+ <property name="windowTitle">
+ <string>Editor</string>
+ </property>
+ <widget class="QWidget" name="centralwidget">
+ <widget class="QWidget" name="verticalLayoutWidget">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>0</y>
+ <width>781</width>
+ <height>551</height>
+ </rect>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <property name="sizeConstraint">
+ <enum>QLayout::SetNoConstraint</enum>
+ </property>
+ <item>
+ <widget class="QScrollArea" name="scrollArea">
+ <property name="horizontalScrollBarPolicy">
+ <enum>Qt::ScrollBarAsNeeded</enum>
+ </property>
+ <property name="widgetResizable">
+ <bool>true</bool>
+ </property>
+ <widget class="QWidget" name="scrollAreaWidgetContents">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>777</width>
+ <height>270</height>
+ </rect>
+ </property>
+ <widget class="QWidget" name="verticalLayoutWidget_2">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>10</y>
+ <width>761</width>
+ <height>251</height>
+ </rect>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="NoteGraphWidget" name="widget" native="true">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </widget>
+ </item>
+ <item>
+ <widget class="QFrame" name="frame">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ <widget class="QMenuBar" name="menubar">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>800</width>
+ <height>26</height>
+ </rect>
+ </property>
+ <widget class="QMenu" name="menu_File">
+ <property name="title">
+ <string>&File</string>
+ </property>
+ <addaction name="action_New"/>
+ <addaction name="action_Open"/>
+ <addaction name="separator"/>
+ <addaction name="action_Save"/>
+ <addaction name="actionS_ave_as"/>
+ <addaction name="separator"/>
+ <addaction name="actionE_xit"/>
+ </widget>
+ <widget class="QMenu" name="menu_Edit">
+ <property name="title">
+ <string>&Edit</string>
+ </property>
+ </widget>
+ <widget class="QMenu" name="menu_Help">
+ <property name="title">
+ <string>&Help</string>
+ </property>
+ <addaction name="action_About"/>
+ </widget>
+ <addaction name="menu_File"/>
+ <addaction name="menu_Edit"/>
+ <addaction name="menu_Help"/>
+ </widget>
+ <widget class="QStatusBar" name="statusbar"/>
+ <action name="action_About">
+ <property name="text">
+ <string>&About</string>
+ </property>
+ </action>
+ <action name="action_New">
+ <property name="text">
+ <string>&New</string>
+ </property>
+ </action>
+ <action name="action_Open">
+ <property name="text">
+ <string>&Open</string>
+ </property>
+ </action>
+ <action name="action_Save">
+ <property name="text">
+ <string>&Save</string>
+ </property>
+ </action>
+ <action name="actionS_ave_as">
+ <property name="text">
+ <string>S&ave as...</string>
+ </property>
+ </action>
+ <action name="actionE_xit">
+ <property name="text">
+ <string>E&xit</string>
+ </property>
+ </action>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>NoteGraphWidget</class>
+ <extends>QWidget</extends>
+ <header>notegraphwidget.hh</header>
+ <container>1</container>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/main.cc b/main.cc
index fd31bbb..4047570 100644
--- a/main.cc
+++ b/main.cc
@@ -39,17 +39,22 @@
****************************************************************************/
#include <QApplication>
-#include "notegraphwidget.hh"
+#include <QScrollArea>
+#include <QHBoxLayout>
+#include "ui_editor.h"
int main(int argc, char *argv[])
{
- Q_INIT_RESOURCE(editor);
+ Q_INIT_RESOURCE(editor);
QApplication app(argc, argv);
#ifdef QT_KEYPAD_NAVIGATION
QApplication::setNavigationMode(Qt::NavigationModeCursorAuto);
#endif
- NoteGraphWidget window;
+
+ QMainWindow window;
+ Ui_MainWindow ui;
+ ui.setupUi(&window);
bool smallScreen = QApplication::arguments().contains("-small-screen");
if (smallScreen)
diff --git a/notegraphwidget.cc b/notegraphwidget.cc
index 88757de..3c1c6ee 100644
--- a/notegraphwidget.cc
+++ b/notegraphwidget.cc
@@ -64,10 +64,6 @@ NoteGraphWidget::NoteGraphWidget(QWidget *parent)
wordLabel->show();
wordLabel->setAttribute(Qt::WA_DeleteOnClose);
x += wordLabel->width() + 2;
- if (x >= 245) {
- x = 5;
- y += wordLabel->height() + 2;
- }
}
}
|