1 #include "texteditor.h"
10 extern int statusbarTime;
11 extern QSettings settings;
13 extern QAction *actionViewToggleNoteEditor;
15 extern QString iconPath;
20 ///////////////////////////////////////////////////////////////////////
21 ///////////////////////////////////////////////////////////////////////
24 TextEditor::TextEditor()
26 printer = new QPrinter( QPrinter::HighResolution );
27 printer->setPrinterName (settings.value("/mainwindow/printerName",printer->printerName()).toString());
29 e = new QTextEdit( this);
31 e->setTextFormat(Qt::RichText); // default
32 e->setTabStopWidth (20); // unit is pixel
33 e->setColor (Qt::black);
34 e->setAutoFillBackground (true);
35 connect (e, SIGNAL( textChanged() ), this, SLOT( editorChanged() ) );
36 setCentralWidget( e );
37 statusBar()->message( tr("Ready","Statusbar message"), statusbarTime);
38 setCaption(__VYM " - " +tr ("Note Editor","Window caption"));
41 connect(e, SIGNAL(currentCharFormatChanged(const QTextCharFormat &)),
42 this, SLOT(formatChanged(const QTextCharFormat &)));
50 setupSettingsActions();
56 resize (settings.value ( "/noteeditor/geometry/size", QSize(450,600)).toSize());
57 move (settings.value ( "/noteeditor/geometry/pos", QPoint (250,50)).toPoint());
59 if (settings.value ( "/noteeditor/showWithMain",true).toBool())
60 setShowWithMain(true);
62 setShowWithMain(false);
64 varFont.fromString( settings.value
65 ("/noteeditor/fonts/varFont",
66 "Nimbus Sans l,14,-1,5,48,0,0,0,0,0").toString()
68 fixedFont.fromString (settings.value(
69 "/noteeditor/fonts/fixedFont",
70 "Courier,14,-1,5,48,0,0,0,1,0").toString()
72 QString s=settings.value ("/noteeditor/fonts/fonthintDefault","variable").toString();
75 actionSettingsFonthintDefault->setOn (true);
76 e->setCurrentFont (fixedFont);
79 actionSettingsFonthintDefault->setOn (false);
80 e->setCurrentFont (varFont);
84 // Restore position of toolbars
85 restoreState (settings.value("/noteeditor/state",0).toByteArray());
87 // Save settings in vymrc
88 settings.setValue("/mainwindow/printerName",printer->printerName());
92 TextEditor::~TextEditor()
94 if (printer) delete printer;
96 settings.setValue( "/noteeditor/geometry/size", size() );
97 settings.setValue( "/noteeditor/geometry/pos", pos() );
98 settings.setValue ("/noteeditor/state",saveState(0));
100 settings.setValue( "/noteeditor/showWithMain",showWithMain());
103 if (actionSettingsFonthintDefault->isOn() )
107 settings.setValue( "/noteeditor/fonts/fonthintDefault",s );
108 settings.setValue("/noteeditor/fonts/varFont", varFont.toString() );
109 settings.setValue("/noteeditor/fonts/fixedFont", fixedFont.toString() );
114 bool TextEditor::isEmpty()
116 if (e->toPlainText().length()>0)
122 void TextEditor::setShowWithMain(bool v)
127 bool TextEditor::showWithMain()
132 void TextEditor::setFontHint (const QString &fh)
135 actionFormatUseFixedFont->setOn (true);
137 actionFormatUseFixedFont->setOn (false);
141 QString TextEditor::getFontHint()
143 if (actionFormatUseFixedFont->isOn())
149 QString TextEditor::getFontHintDefault()
151 if (actionSettingsFonthintDefault->isOn())
157 void TextEditor::setFilename(const QString &fn)
159 if (state==filledEditor)
163 statusBar()->message( tr("No filename available for this note.","Statusbar message"), statusbarTime );
168 statusBar()->message( tr(QString( "Current filename is %1" ).arg( filename ),"Statusbar message"), statusbarTime );
172 QString TextEditor::getFilename()
177 void TextEditor::setFilenameHint(const QString &fnh)
182 QString TextEditor::getFilenameHint()
187 bool TextEditor::findText(const QString &t, const QTextDocument::FindFlags &flags)
189 if (e->find (t,flags))
195 void TextEditor::setupFileActions()
197 QToolBar *tb = addToolBar ( tr("Note Actions") );
198 tb->setObjectName ("noteEditorFileActions");
199 QMenu *fileMenu = menuBar()->addMenu( tr( "&Note","Menubar" ));
202 a = new QAction( QPixmap( iconPath+"fileopen.png"), tr( "&Import..." ),this);
203 a->setStatusTip (tr( "Import","Status tip for Note menu" ) );
204 a->setShortcut( Qt::CTRL + Qt::Key_O );
205 connect( a, SIGNAL( activated() ), this, SLOT( textLoad() ) );
207 fileMenu->addAction (a);
210 fileMenu->addSeparator();
211 a = new QAction( QPixmap(iconPath+"filesave.png" ), tr( "&Export..." ),this);
212 a->setStatusTip (tr( "Export Note (HTML)","Status tip for Note menu" ) );
213 a->setShortcut( Qt::CTRL + Qt::Key_S );
214 connect( a, SIGNAL( activated() ), this, SLOT( textSave() ) );
216 fileMenu->addAction (a);
219 a = new QAction( QPixmap(), tr( "Export &As... (HTML)" ), this);
220 a->setStatusTip (tr( "Export Note As (HTML) ","Status tip for Note Menu" ));
221 connect( a, SIGNAL( activated() ), this, SLOT( textSaveAs() ) );
222 fileMenu->addAction (a);
225 a = new QAction(QPixmap(), tr( "Export &As...(ASCII)" ), this);
226 a->setStatusTip ( tr( "Export Note As (ASCII) ","Status tip for note menu" ) );
227 a->setShortcut(Qt::ALT + Qt::Key_X );
228 connect( a, SIGNAL( activated() ), this, SLOT( textExportAsASCII() ) );
229 fileMenu->addAction (a);
232 fileMenu->addSeparator();
233 a = new QAction( QPixmap(iconPath+"fileprint.png" ), tr( "&Print..." ),this);
234 a->setStatusTip (tr( "Print Note","Status tip for note menu" ) );
235 a->setShortcut( Qt::CTRL + Qt::Key_P );
236 connect( a, SIGNAL( activated() ), this, SLOT( textPrint() ) );
238 fileMenu->addAction (a);
242 void TextEditor::setupEditActions()
244 QToolBar *tb = addToolBar ( tr( "Edit Actions" ));
245 tb->setObjectName ("noteEditorEditActions");
246 QMenu *editMenu = menuBar()->addMenu ( tr( "&Edit" ));
249 a = new QAction(QPixmap(iconPath+"undo.png"), tr( "&Undo" ), this );
250 a->setStatusTip ( tr( "Undo","Status tip for note menu" ) );
251 a->setShortcut(Qt::CTRL + Qt::Key_Z );
252 connect( a, SIGNAL( activated() ), e, SLOT( undo() ) );
253 editMenu->addAction (a);
257 a = new QAction(QPixmap(iconPath+"redo.png" ), tr( "&Redo" ),this);
258 a->setStatusTip ( tr( "Redo","Status tip for note menu" ) );
259 a->setShortcut( Qt::CTRL + Qt::Key_Y );
260 connect( a, SIGNAL( activated() ), e, SLOT( redo() ) );
261 editMenu->addAction (a);
265 editMenu->addSeparator();
266 a = new QAction(QPixmap(), tr( "Select and copy &all" ),this);
267 a->setStatusTip ( tr( "Select and copy all","Status tip for note menu" ) );
268 a->setShortcut( Qt::CTRL + Qt::Key_A );
269 connect( a, SIGNAL( activated() ), this, SLOT( editCopyAll() ) );
270 editMenu->addAction (a);
272 editMenu->addSeparator();
273 a = new QAction(QPixmap(iconPath+"editcopy.png" ), tr( "&Copy" ),this);
274 a->setStatusTip ( tr( "Copy","Status tip for note menu" ) );
275 a->setShortcut( Qt::CTRL + Qt::Key_C );
276 connect( a, SIGNAL( activated() ), e, SLOT( copy() ) );
277 editMenu->addAction (a);
281 a = new QAction(QPixmap(iconPath+"editcut.png" ), tr( "Cu&t" ),this);
282 a->setStatusTip ( tr( "Cut","Status tip for note menu" ) );
283 a->setShortcut( Qt::CTRL + Qt::Key_X );
284 connect( a, SIGNAL( activated() ), e, SLOT( cut() ) );
285 editMenu->addAction (a);
289 a = new QAction(QPixmap(iconPath+"editpaste.png" ), tr( "&Paste" ),this);
290 a->setStatusTip ( tr( "Paste","Status tip for note menu" ) );
291 a->setShortcut( Qt::CTRL + Qt::Key_V );
292 connect( a, SIGNAL( activated() ), e, SLOT( paste() ) );
293 editMenu->addAction (a);
297 a = new QAction( QPixmap( iconPath+"edittrash.png"), tr( "&Delete All" ), this);
298 a->setStatusTip (tr( "Delete all","Status tip for note menu" ) );
299 connect( a, SIGNAL( activated() ), e, SLOT( clear() ) );
300 editMenu->addAction (a);
302 actionEditDeleteAll=a;
306 void TextEditor::setupFormatActions()
308 QToolBar *tb = addToolBar ( tr("Format Actions" ));
309 tb->setObjectName ("noteEditorFormatActions");
310 QMenu *formatMenu = menuBar()->addMenu ( tr( "F&ormat" ));
314 a = new QAction( QPixmap(iconPath+"formatfixedfont.png"), tr( "&Font hint" ), Qt::ALT + Qt::Key_I, this, "fontHint" );
315 a->setStatusTip (tr( "Toggle font hint for the whole text","Status tip for note menu" ) );
316 a->setToggleAction (true);
317 a->setOn (settings.value("/noteeditor/fonts/useFixedByDefault",false).toBool() );
318 connect( a, SIGNAL( activated() ), this, SLOT( toggleFonthint() ) );
319 formatMenu->addAction (a);
321 actionFormatUseFixedFont=a;
323 comboFont = new QComboBox;
324 tb->addWidget (comboFont);
325 QFontDatabase fontDB;
326 comboFont->insertStringList( fontDB.families() );
327 connect( comboFont, SIGNAL( activated( const QString & ) ),
328 this, SLOT( textFamily( const QString & ) ) );
329 comboFont->addItem( QApplication::font().family() );
330 comboSize = new QComboBox;
331 tb->addWidget (comboSize);
332 QList<int> sizes=fontDB.standardSizes();
333 QList<int>::iterator i = sizes.begin();
334 while (i != sizes.end())
336 ++i; // increment i before using it
337 comboSize->insertItem ( QString::number(*i));
339 connect( comboSize, SIGNAL( activated( const QString & ) ),
340 this, SLOT( textSize( const QString & ) ) );
341 comboSize->addItem ( QString::number( QApplication::font().pointSize() ) );
343 formatMenu->addSeparator();
345 QPixmap pix( 16, 16 );
346 pix.fill( e->color());
347 a = new QAction( pix, tr( "&Color..." ), this);
348 formatMenu->addAction (a);
350 connect( a, SIGNAL( activated() ), this, SLOT( textColor() ) );
353 a = new QAction( QPixmap (iconPath+"text_bold.png"), tr( "&Bold" ), this);
354 a->setShortcut(Qt::CTRL + Qt::Key_B );
355 connect( a, SIGNAL( activated() ), this, SLOT( textBold() ) );
357 formatMenu->addAction (a);
358 a->setToggleAction( true );
361 a = new QAction( QPixmap(iconPath+"text_italic.png"), tr( "&Italic" ), this);
362 a->setShortcut(Qt::CTRL + Qt::Key_I);
363 connect( a, SIGNAL( activated() ), this, SLOT( textItalic() ) );
365 formatMenu->addAction (a);
366 a->setToggleAction( true );
369 a = new QAction( QPixmap (iconPath+"text_under.png"), tr( "&Underline" ), this);
370 a->setShortcut(Qt::CTRL + Qt::Key_U );
371 connect( a, SIGNAL( activated() ), this, SLOT( textUnderline() ) );
373 formatMenu->addAction (a);
374 a->setToggleAction( true );
375 actionTextUnderline=a;
376 formatMenu->addSeparator();
378 QActionGroup *grp2 = new QActionGroup( this );
379 grp2->setExclusive(true);
380 a = new QAction( QPixmap (iconPath+"text_sub.png"), tr( "Subs&cript" ),grp2 );
381 a->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_B );
382 a->setToggleAction( true );
384 formatMenu->addAction (a);
385 connect(a, SIGNAL(activated()), this, SLOT(textVAlign()));
386 actionAlignSubScript=a;
388 a = new QAction( QPixmap (iconPath+"text_super.png"), tr( "Su&perscript" ),grp2 );
389 a->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_P );
390 a->setToggleAction( true );
392 formatMenu->addAction (a);
393 connect(a, SIGNAL(activated()), this, SLOT(textVAlign()));
394 actionAlignSuperScript=a;
395 QActionGroup *grp = new QActionGroup( this );
396 connect( grp, SIGNAL( selected( QAction* ) ), this, SLOT( textAlign( QAction* ) ) );
398 formatMenu->addSeparator();
400 a = new QAction( QPixmap (iconPath+"text_left.png"), tr( "&Left" ),grp );
401 a->setShortcut( Qt::CTRL+Qt::Key_L );
402 a->setToggleAction( true );
404 formatMenu->addAction (a);
406 a = new QAction( QPixmap (iconPath+"text_center.png"), tr( "C&enter" ),grp);
407 a->setShortcut( Qt::CTRL + Qt::Key_E);
408 a->setToggleAction( true );
410 formatMenu->addAction (a);
412 a = new QAction( QPixmap (iconPath+"text_right.png" ), tr( "&Right" ), grp);
413 a->setShortcut(Qt::CTRL + Qt::Key_R );
414 a->setToggleAction( true );
416 formatMenu->addAction (a);
418 a = new QAction( QPixmap ( iconPath+"text_block.png"), tr( "&Justify" ), grp );
419 a->setShortcut(Qt::CTRL + Qt::Key_J );
420 a->setToggleAction( true );
422 formatMenu->addAction (a);
423 actionAlignJustify=a;
426 void TextEditor::setupSettingsActions()
428 QMenu *settingsMenu = menuBar()->addMenu ( tr( "&Settings" ));
431 a = new QAction(tr( "Set &fixed font" ), this);
432 a->setStatusTip ( tr( "Set fixed font","Status tip for note menu" ));
433 connect( a, SIGNAL( activated() ), this, SLOT( setFixedFont() ) );
434 settingsMenu->addAction (a);
435 actionSettingsFixedFont=a;
437 a = new QAction(tr( "Set &variable font" ), this);
438 a->setStatusTip ( tr( "Set variable font","Status tip for note menu" ) );
439 connect( a, SIGNAL( activated() ), this, SLOT( setVarFont() ) );
440 settingsMenu->addAction (a);
441 actionSettingsVarFont=a;
443 a = new QAction(tr( "&fixed font is default" ), this);
444 a->setStatusTip (tr( "Used fixed font by default","Status tip for note menu" ) );
445 a->setToggleAction (true);
446 // set state later in constructor...
447 settingsMenu->addAction (a);
448 actionSettingsFonthintDefault=a;
451 void TextEditor::textLoad()
453 if (state!=inactiveEditor)
455 if (e->text().length())
457 QMessageBox mb( __VYM " - " +tr("Note Editor"),
458 "Loading will overwrite the existing note",
459 QMessageBox::Warning,
460 QMessageBox::Yes | QMessageBox::Default,
463 mb.setButtonText( QMessageBox::Yes, "Load note" );
464 switch( mb.exec() ) {
465 case QMessageBox::Cancel:
471 QFileDialog *fd=new QFileDialog( this);
473 types<< "VYM notes (*.html)" <<
474 "ASCII texts (*.txt)" <<
476 fd->setFilters (types);
477 fd->setDirectory (QDir().current());
480 if ( fd->exec() == QDialog::Accepted )
481 fn = fd->selectedFile();
486 if ( !f.open( QIODevice::ReadOnly ) )
489 QTextStream ts( &f );
490 setText( ts.read() );
496 void TextEditor::closeEvent( QCloseEvent* ce )
498 ce->accept(); // TextEditor can be reopened with show()
500 emit (textEditorClosed() );
504 QString TextEditor::getText()
506 if (e->toPlainText().isEmpty())
512 void TextEditor::editorChanged()
519 if (state==emptyEditor)
520 setState (emptyEditor);
522 setState (filledEditor);
523 // SLOT is LinkableMapObj, which will update systemFlag
524 emit (textHasChanged() );
528 void TextEditor::setText(QString t)
530 e->setReadOnly(false);
535 void TextEditor::setInactive()
537 state=inactiveEditor;
539 setState (inactiveEditor);
540 e->setReadOnly (true);
545 void TextEditor::editCopyAll()
551 void TextEditor::textSaveAs()
553 QString fn = QFileDialog::getSaveFileName( QString::null, "VYM Note (HTML) (*.html);;All files (*)",
554 this,"export note dialog",tr("Export Note to single file") );
561 QMessageBox mb( __VYM,
562 tr("The file %1\nexists already.\nDo you want to overwrite it?","dialog 'save note as'").arg(fn),
563 QMessageBox::Warning,
564 QMessageBox::Yes | QMessageBox::Default,
565 QMessageBox::Cancel | QMessageBox::Escape,
567 mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
568 mb.setButtonText( QMessageBox::No, tr("Cancel"));
569 switch( mb.exec() ) {
570 case QMessageBox::Yes:
575 case QMessageBox::Cancel:
586 statusBar()->message(tr( "Couldn't export note ","dialog 'save note as'") + fn, statusbarTime );
590 void TextEditor::textSave()
592 if ( filename.isEmpty() )
598 QString text = e->text();
600 if ( !f.open( QIODevice::WriteOnly ) )
602 statusBar()->message( QString("Could not write to %1").arg(filename),
611 e->setModified( FALSE );
613 statusBar()->message( QString( "Note exported as %1" ).arg( filename ), statusbarTime );
616 void TextEditor::textExportAsASCII()
618 QString text = NoteObj (e->text()).getNoteASCII();
620 if (!filenameHint.isEmpty())
622 if (!filenameHint.contains (".txt"))
623 s=filenameHint+".txt";
628 fn = QFileDialog::getSaveFileName( s, "VYM Note (ASCII) (*.txt);;All files (*)", this,"export note dialog",tr("Export Note to single file (ASCII)") );
636 QMessageBox mb( __VYM,
637 tr("The file %1\nexists already.\nDo you want to overwrite it?","dialog 'save note as'").arg(fn),
638 QMessageBox::Warning,
639 QMessageBox::Yes | QMessageBox::Default,
640 QMessageBox::Cancel | QMessageBox::Escape,
642 mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
643 mb.setButtonText( QMessageBox::No, tr("Cancel"));
646 if (ret==QMessageBox::Cancel)
650 if ( !file.open( QIODevice::WriteOnly ) )
651 statusBar()->message( QString("Could not write to %1").arg(filename),
655 QTextStream t( &file );
659 statusBar()->message( QString( "Note exported as %1" ).arg( fn ), statusbarTime );
665 void TextEditor::textPrint()
668 QTextDocument *document = e->document();
671 QPrintDialog *dialog = new QPrintDialog(&printer, this);
672 dialog->setWindowTitle(tr("Print Note"));
673 if (dialog->exec() != QDialog::Accepted)
676 document->print(&printer);
679 void TextEditor::textEditUndo()
683 void TextEditor::toggleFonthint()
685 setUpdatesEnabled (false);
687 if (!actionFormatUseFixedFont->isOn() )
688 e->setCurrentFont (varFont);
690 e->setCurrentFont (fixedFont);
692 setUpdatesEnabled (true);
696 void TextEditor::setFixedFont()
699 QFont font =QFontDialog::getFont(
700 &ok, fixedFont, this );
702 // font is set to the font the user selected
706 void TextEditor::setVarFont()
709 QFont font =QFontDialog::getFont(
710 &ok, varFont, this );
712 // font is set to the font the user selected
716 void TextEditor::textBold()
718 e->setBold( actionTextBold->isOn() );
721 void TextEditor::textUnderline()
723 e->setUnderline( actionTextUnderline->isOn() );
726 void TextEditor::textItalic()
728 e->setItalic( actionTextItalic->isOn() );
731 void TextEditor::textFamily( const QString &f )
736 void TextEditor::textSize( const QString &p )
738 e->setPointSize( p.toInt() );
742 void TextEditor::textColor()
744 QColor col = QColorDialog::getColor( e->color(), this );
745 if ( !col.isValid() ) return;
747 QPixmap pix( 16, 16 );
748 pix.fill( Qt::black );
749 actionTextColor->setIconSet( pix );
752 void TextEditor::textAlign( QAction *a )
754 if ( a == actionAlignLeft )
755 e->setAlignment( Qt::AlignLeft );
756 else if ( a == actionAlignCenter )
757 e->setAlignment( Qt::AlignHCenter );
758 else if ( a == actionAlignRight )
759 e->setAlignment( Qt::AlignRight );
760 else if ( a == actionAlignJustify )
761 e->setAlignment( Qt::AlignJustify );
764 void TextEditor::textVAlign()
766 QTextCharFormat format;
768 if ( sender() == actionAlignSuperScript && actionAlignSuperScript->isOn()) {
769 format.setVerticalAlignment(QTextCharFormat::AlignSuperScript);
770 } else if (sender() == actionAlignSubScript && actionAlignSubScript->isOn()) {
771 format.setVerticalAlignment(QTextCharFormat::AlignSubScript);
773 format.setVerticalAlignment(QTextCharFormat::AlignNormal);
775 e->mergeCurrentCharFormat(format);
779 void TextEditor::fontChanged( const QFont &f )
781 int i=comboFont->findText(f.family());
782 if (i>=0) comboFont->setCurrentIndex (i);
783 i=comboSize->findText(QString::number(f.pointSize()));
784 if (i>=0) comboSize->setCurrentIndex(i);
785 actionTextBold->setOn( f.bold() );
786 actionTextItalic->setOn( f.italic() );
787 actionTextUnderline->setOn( f.underline() );
790 void TextEditor::colorChanged( const QColor &c )
792 QPixmap pix( 16, 16 );
794 actionTextColor->setIconSet( pix );
797 void TextEditor::formatChanged( const QTextCharFormat &f )
799 fontChanged(f.font());
800 colorChanged(f.foreground().color());
801 alignmentChanged(e->alignment());
802 verticalAlignmentChanged (f.verticalAlignment());
805 void TextEditor::alignmentChanged( int a )
807 if ( ( a == Qt::AlignLeft ) || ( a & Qt::AlignLeft ))
808 actionAlignLeft->setOn( true );
809 else if ( ( a & Qt::AlignHCenter ) )
810 actionAlignCenter->setOn( true );
811 else if ( ( a & Qt::AlignRight ) )
812 actionAlignRight->setOn( true );
813 else if ( ( a & Qt::AlignJustify ) )
814 actionAlignJustify->setOn( true );
817 void TextEditor::verticalAlignmentChanged(QTextCharFormat::VerticalAlignment a)
819 actionAlignSubScript->setOn (false);
820 actionAlignSuperScript->setOn (false);
823 case QTextCharFormat::AlignSuperScript:
824 actionAlignSuperScript->setOn (true);
826 case QTextCharFormat::AlignSubScript:
827 actionAlignSubScript->setOn (true);
835 void TextEditor::enableActions()
837 actionFileLoad->setEnabled(true);
838 actionFileSave->setEnabled(true);
839 actionFileSaveAs->setEnabled(true);
840 actionFilePrint->setEnabled(true);
841 actionEditUndo->setEnabled(true);
842 actionEditRedo->setEnabled(true);
843 actionEditCopy->setEnabled(true);
844 actionEditCut->setEnabled(true);
845 actionEditPaste->setEnabled(true);
846 actionEditDeleteAll->setEnabled(true);
847 actionFormatUseFixedFont->setEnabled(true);
850 void TextEditor::disableActions()
852 actionFileLoad->setEnabled(false);
853 actionFileSave->setEnabled(false);
854 actionFileSaveAs->setEnabled(false);
855 actionFilePrint->setEnabled(false);
856 actionEditUndo->setEnabled(false);
857 actionEditRedo->setEnabled(false);
858 actionEditCopy->setEnabled(false);
859 actionEditCut->setEnabled(false);
860 actionEditPaste->setEnabled(false);
861 actionEditDeleteAll->setEnabled(false);
862 actionFormatUseFixedFont->setEnabled(false);
865 void TextEditor::setState (EditorState s)
868 QPalette p=palette();
872 case emptyEditor: c=QColor (150,150,150); break;
873 case filledEditor: c=QColor (255,255,255); break;
874 case inactiveEditor: c=QColor (0,0,0);
876 p.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(9), c);
877 p.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(9), c);