//! [0] MainWindow::MainWindow() { createActions(); createMenus(); centralWidget = new Previewer(this); setCentralWidget(centralWidget); setStartupText(); }
//! [0] MainWindow::MainWindow() { createActions(); createMenus(); centralWidget = new Previewer(this); setCentralWidget(centralWidget); connect(centralWidget->webView, SIGNAL(loadFinished(bool)), this, SLOT(updateTextEdit())); setStartupText(); }
Html_Viewer::Html_Viewer() : QMainWindow(), ui(new Ui::Html_Form) { QWidget *temp = new QWidget(this); setCentralWidget(temp); ui->setupUi(temp); setWindowTitle("Html Viewer"); createActions(); setStartupText(); // signals connect(ui->webView, SIGNAL(loadFinished(bool)), this, SLOT(updateTextEdit())); connect(ui->clearPB, SIGNAL(clicked()), ui->plainTextEdit, SLOT(clear()) ); connect(ui->previewPB, SIGNAL(clicked()), this, SLOT(actionPreview()) ); }
/** Constructor */ CreateBlogMsg::CreateBlogMsg(std::string cId ,QWidget* parent, Qt::WFlags flags) : mBlogId(cId), QMainWindow (parent, flags) { /* Invoke the Qt Designer generated object setup routine */ ui.setupUi(this); setAttribute ( Qt::WA_DeleteOnClose, true ); setupFileActions(); setupEditActions(); setupViewActions(); setupInsertActions(); setupParagraphActions(); setAcceptDrops(true); setStartupText(); newBlogMsg(); ui.toolBar_2->addAction(ui.actionIncreasefontsize); ui.toolBar_2->addAction(ui.actionDecreasefontsize); ui.toolBar_2->addAction(ui.actionBlockquoute); ui.toolBar_2->addAction(ui.actionOrderedlist); ui.toolBar_2->addAction(ui.actionUnorderedlist); ui.toolBar_2->addAction(ui.actionBlockquoute); ui.toolBar_2->addAction(ui.actionCode); ui.toolBar_2->addAction(ui.actionsplitPost); setupTextActions(); connect(ui.actionPublish, SIGNAL(triggered()), this, SLOT(sendMsg())); connect(ui.actionNew, SIGNAL(triggered()), this, SLOT (fileNew())); connect(ui.actionIncreasefontsize, SIGNAL (triggered()), this, SLOT (fontSizeIncrease())); connect(ui.actionDecreasefontsize, SIGNAL (triggered()), this, SLOT (fontSizeDecrease())); connect(ui.actionBlockquoute, SIGNAL (triggered()), this, SLOT (blockQuote())); connect(ui.actionCode, SIGNAL (triggered()), this, SLOT (toggleCode())); connect(ui.actionsplitPost, SIGNAL (triggered()), this, SLOT (addPostSplitter())); connect(ui.actionOrderedlist, SIGNAL (triggered()), this, SLOT (addOrderedList())); connect(ui.actionUnorderedlist, SIGNAL (triggered()), this, SLOT (addUnorderedList())); //connect(webView, SIGNAL(loadFinished(bool)),this, SLOT(updateTextEdit())); connect( ui.msgEdit, SIGNAL( textChanged(const QString &)), this, SLOT(updateTextEdit())); connect( ui.msgEdit, SIGNAL(currentCharFormatChanged(QTextCharFormat)), this, SLOT(currentCharFormatChanged(QTextCharFormat))); connect( ui.msgEdit, SIGNAL(cursorPositionChanged()), this, SLOT(cursorPositionChanged())); QPalette palette = QApplication::palette(); codeBackground = palette.color( QPalette::Active, QPalette::Midlight ); fontChanged(ui.msgEdit->font()); colorChanged(ui.msgEdit->textColor()); alignmentChanged(ui.msgEdit->alignment()); connect( ui.msgEdit->document(), SIGNAL(modificationChanged(bool)), actionSave, SLOT(setEnabled(bool))); connect( ui.msgEdit->document(), SIGNAL(modificationChanged(bool)), this, SLOT(setWindowModified(bool))); connect( ui.msgEdit->document(), SIGNAL(undoAvailable(bool)), actionUndo, SLOT(setEnabled(bool))); connect( ui.msgEdit->document(), SIGNAL(undoAvailable(bool)), ui.actionUndo, SLOT(setEnabled(bool))); connect( ui.msgEdit->document(), SIGNAL(redoAvailable(bool)), actionRedo, SLOT(setEnabled(bool))); setWindowModified( ui.msgEdit->document()->isModified()); actionSave->setEnabled( ui.msgEdit->document()->isModified()); actionUndo->setEnabled( ui.msgEdit->document()->isUndoAvailable()); ui.actionUndo->setEnabled( ui.msgEdit->document()->isUndoAvailable()); actionRedo->setEnabled( ui.msgEdit->document()->isRedoAvailable()); connect(actionUndo, SIGNAL(triggered()), ui.msgEdit, SLOT(undo())); connect(ui.actionUndo, SIGNAL(triggered()), ui.msgEdit, SLOT(undo())); connect(actionRedo, SIGNAL(triggered()), ui.msgEdit, SLOT(redo())); actionCut->setEnabled(false); actionCopy->setEnabled(false); connect(actionCut, SIGNAL(triggered()), ui.msgEdit, SLOT(cut())); connect(actionCopy, SIGNAL(triggered()), ui.msgEdit, SLOT(copy())); connect(actionPaste, SIGNAL(triggered()), ui.msgEdit, SLOT(paste())); connect(ui.msgEdit, SIGNAL(copyAvailable(bool)), actionCut, SLOT(setEnabled(bool))); connect(ui.msgEdit, SIGNAL(copyAvailable(bool)), actionCopy, SLOT(setEnabled(bool))); #ifndef QT_NO_CLIPBOARD connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(clipboardDataChanged())); #endif //defaultCharFormat defaultCharFormat = ui.msgEdit->currentCharFormat(); const QFont defaultFont = ui.msgEdit->document()->defaultFont(); defaultCharFormat.setFont( defaultFont ); defaultCharFormat.setForeground( ui.msgEdit->currentCharFormat().foreground() ); defaultCharFormat.setProperty( QTextFormat::FontSizeAdjustment, QVariant( 0 ) ); defaultCharFormat.setBackground( palette.color( QPalette::Active, QPalette::Base ) ); defaultCharFormat.setProperty( TextFormat::HasCodeStyle, QVariant( false ) ); //defaultBlockFormat defaultBlockFormat = ui.msgEdit->textCursor().blockFormat(); }