Delete closeEvent and and ButtonBox to htmleditor

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2082 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
cfdev
2013-04-01 16:19:05 +00:00
parent b10c83f8fe
commit 5c8a1bee57
5 changed files with 91 additions and 666 deletions

View File

@@ -27,14 +27,15 @@
- 26/03/2013 : Start integration...Compilation and object creation are successful
*/
#include "htmleditor.h"
#include "highlighter.h"
#include "../ui/ui_htmleditor.h"
#include "../ui/ui_inserthtmldialog.h"
#include "htmleditor.h"
#include "highlighter.h"
#include <QtGui>
#include <QtWebKit>
#include <QFontDatabase>
#define FORWARD_ACTION(action1, action2) \
connect(action1, SIGNAL(triggered()), \
@@ -55,7 +56,7 @@ HtmlEditor::HtmlEditor(QWidget *parent)
ui->tabWidget->setTabText(0, "Normal View");
ui->tabWidget->setTabText(1, "HTML Source");
connect(ui->tabWidget, SIGNAL(currentChanged(int)), SLOT(changeTab(int)));
resize(600, 600);
resize(600, 300);
highlighter = new Highlighter(ui->plainTextEdit->document());
@@ -568,21 +569,6 @@ void HtmlEditor::changeZoom(int percent)
zoomSlider->setValue(percent);
}
/**
* @brief HtmlEditor::closeEvent and send a applyEditText signal!
* @param e
*/
void HtmlEditor::closeEvent(QCloseEvent *e)
{
/*if (maybeSave())
e->accept();
else
e->ignore();*/
//start applyEdit
emit applyEditText( ui->webView->page()->mainFrame()->toHtml() );
}
/**
* @brief HtmlEditor::loadHtml to the editor
* @param f
@@ -643,3 +629,19 @@ void HtmlEditor::setCurrentFileName(const QString &fileName)
}
/**
* @brief HtmlEditor::on_buttonBox_accepted
*/
void HtmlEditor::on_buttonBox_accepted() {
emit applyEditText( ui->webView->page()->mainFrame()->toHtml() );
this->close();
}
/**
* @brief HtmlEditor::on_buttonBox_rejected
*/
void HtmlEditor::on_buttonBox_rejected() {
this->close();
}

View File

@@ -50,9 +50,6 @@ public:
void loadHtml(const QString &f);
void setSimpleDisplay(bool state);
protected:
virtual void closeEvent(QCloseEvent *e);
private:
void setupActions();
void setupToolBar();
@@ -116,7 +113,9 @@ private:
Ui_Dialog *ui_dialog;
QDialog *insertHtmlDialog;
private slots:
void on_buttonBox_accepted();
void on_buttonBox_rejected();
};
#endif // HTML_EDITOR_H

View File

@@ -6,72 +6,83 @@
<rect>
<x>0</x>
<y>0</y>
<width>659</width>
<height>398</height>
<width>562</width>
<height>361</height>
</rect>
</property>
<property name="windowTitle">
<string>HTML Editor</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="margin">
<number>0</number>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="tabPosition">
<enum>QTabWidget::South</enum>
</property>
<property name="tabShape">
<enum>QTabWidget::Rounded</enum>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<property name="documentMode">
<bool>true</bool>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>Tab 1</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="margin">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="tabPosition">
<enum>QTabWidget::South</enum>
</property>
<property name="tabShape">
<enum>QTabWidget::Rounded</enum>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<item>
<widget class="QWebView" name="webView">
<property name="url">
<url>
<string>about:blank</string>
</url>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>Tab 2</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="margin">
<number>0</number>
<property name="documentMode">
<bool>true</bool>
</property>
<item>
<widget class="QPlainTextEdit" name="plainTextEdit">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>Tab 1</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QWebView" name="webView">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="url">
<url>
<string>about:blank</string>
</url>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>Tab 2</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="margin">
<number>0</number>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<item>
<widget class="QPlainTextEdit" name="plainTextEdit">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
@@ -80,7 +91,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>659</width>
<width>562</width>
<height>31</height>
</rect>
</property>