1 #include "texteditor.h"
8 #include <qtextstream.h>
10 #include <QFontDialog>
11 #include <QMessageBox>
12 #include <QColorDialog>
16 #include <QCloseEvent>
25 extern int statusbarTime;
26 extern QSettings settings;
28 extern QAction *actionViewToggleNoteEditor;
30 extern QString iconPath;
35 ///////////////////////////////////////////////////////////////////////
36 ///////////////////////////////////////////////////////////////////////
39 TextEditor::TextEditor()
41 printer = new QPrinter( QPrinter::HighResolution );
42 printer->setPrinterName (settings.value("/mainwindow/printerName",printer->printerName()).toString());
44 e = new QTextEdit( this);
46 e->setTextFormat(Qt::RichText); // default
47 e->setTabStopWidth (20); // unit is pixel
48 e->setColor (Qt::black);
49 e->setAutoFillBackground (true);
50 connect (e, SIGNAL( textChanged() ), this, SLOT( editorChanged() ) );
51 setCentralWidget( e );
52 statusBar()->message( tr("Ready","Statusbar message"), statusbarTime);
53 setCaption(__VYM " - " +tr ("Note Editor"));
56 connect(e, SIGNAL(currentCharFormatChanged(const QTextCharFormat &)),
57 this, SLOT(formatChanged(const QTextCharFormat &)));
65 setupSettingsActions();
71 resize (settings.value ( "/noteeditor/geometry/size", QSize(450,600)).toSize());
72 move (settings.value ( "/noteeditor/geometry/pos", QPoint (250,50)).toPoint());
74 if (settings.value ( "/noteeditor/showWithMain",true).toBool())
75 setShowWithMain(true);
77 setShowWithMain(false);
79 varFont.fromString( settings.value
80 ("/noteeditor/fonts/varFont",
81 "Nimbus Sans l,14,-1,5,48,0,0,0,0,0").toString()
83 fixedFont.fromString (settings.value(
84 "/noteeditor/fonts/fixedFont",
85 "Courier,14,-1,5,48,0,0,0,1,0").toString()
87 QString s=settings.value ("/noteeditor/fonts/fonthintDefault","variable").toString();
90 actionSettingsFonthintDefault->setOn (true);
91 e->setCurrentFont (fixedFont);
94 actionSettingsFonthintDefault->setOn (false);
95 e->setCurrentFont (varFont);
99 // Restore position of toolbars
100 restoreState (settings.value("/noteeditor/state",0).toByteArray());
102 // Save settings in vymrc
103 settings.setValue("/mainwindow/printerName",printer->printerName());
107 TextEditor::~TextEditor()
109 if (printer) delete printer;
111 settings.setValue( "/noteeditor/geometry/size", size() );
112 settings.setValue( "/noteeditor/geometry/pos", pos() );
113 settings.setValue ("/noteeditor/state",saveState(0));
115 settings.setValue( "/noteeditor/showWithMain",showWithMain());
118 if (actionSettingsFonthintDefault->isOn() )
122 settings.setValue( "/noteeditor/fonts/fonthintDefault",s );
123 settings.setValue("/noteeditor/fonts/varFont", varFont.toString() );
124 settings.setValue("/noteeditor/fonts/fixedFont", fixedFont.toString() );
129 bool TextEditor::isEmpty()
131 if (e->toPlainText().length()>0)
137 void TextEditor::setShowWithMain(bool v)
142 bool TextEditor::showWithMain()
147 void TextEditor::setFontHint (const QString &fh)
150 actionFormatUseFixedFont->setOn (true);
152 actionFormatUseFixedFont->setOn (false);
156 QString TextEditor::getFontHint()
158 if (actionFormatUseFixedFont->isOn())
164 QString TextEditor::getFontHintDefault()
166 if (actionSettingsFonthintDefault->isOn())
172 void TextEditor::setFilename(const QString &fn)
174 if (state==filledEditor)
178 statusBar()->message( tr("No filename available for this note.","Statusbar message"), statusbarTime );
183 statusBar()->message( tr(QString( "Current filename is %1" ).arg( filename ),"Statusbar message"), statusbarTime );
187 QString TextEditor::getFilename()
192 void TextEditor::setFilenameHint(const QString &fnh)
197 QString TextEditor::getFilenameHint()
202 bool TextEditor::findText(const QString &t, const QTextDocument::FindFlags &flags)
204 if (e->find (t,flags))
210 void TextEditor::setupFileActions()
212 QToolBar *tb = addToolBar ( tr("Note Actions") );
213 tb->setObjectName ("noteEditorFileActions");
214 QMenu *fileMenu = menuBar()->addMenu( tr( "&Note" ));
217 a = new QAction( QPixmap( iconPath+"fileopen.png"), tr( "&Import..." ),this);
218 a->setStatusTip (tr( "Import" ) );
219 a->setShortcut( Qt::CTRL + Qt::Key_O );
220 connect( a, SIGNAL( activated() ), this, SLOT( textLoad() ) );
222 fileMenu->addAction (a);
225 fileMenu->addSeparator();
226 a = new QAction( QPixmap(iconPath+"filesave.png" ), tr( "&Export..." ),this);
227 a->setStatusTip (tr( "Export Note (HTML)" ) );
228 a->setShortcut( Qt::CTRL + Qt::Key_S );
229 connect( a, SIGNAL( activated() ), this, SLOT( textSave() ) );
231 fileMenu->addAction (a);
234 a = new QAction( QPixmap(), tr( "Export &As... (HTML)" ), this);
235 a->setStatusTip (tr( "Export Note As (HTML) " ));
236 connect( a, SIGNAL( activated() ), this, SLOT( textSaveAs() ) );
237 fileMenu->addAction (a);
240 a = new QAction(QPixmap(), tr( "Export &As...(ASCII)" ), this);
241 a->setStatusTip ( tr( "Export Note As (ASCII) " ) );
242 a->setShortcut(Qt::ALT + Qt::Key_X );
243 connect( a, SIGNAL( activated() ), this, SLOT( textExportAsASCII() ) );
244 fileMenu->addAction (a);
247 fileMenu->addSeparator();
248 a = new QAction( QPixmap(iconPath+"fileprint.png" ), tr( "&Print..." ),this);
249 a->setStatusTip (tr( "Print Note" ) );
250 a->setShortcut( Qt::CTRL + Qt::Key_P );
251 connect( a, SIGNAL( activated() ), this, SLOT( textPrint() ) );
253 fileMenu->addAction (a);
257 void TextEditor::setupEditActions()
259 QToolBar *tb = addToolBar ( tr( "Edit Actions" ));
260 tb->setObjectName ("noteEditorEditActions");
261 QMenu *editMenu = menuBar()->addMenu ( tr( "&Edit" ));
264 a = new QAction(QPixmap(iconPath+"undo.png"), tr( "&Undo" ), this );
265 a->setStatusTip ( tr( "Undo" ) );
266 a->setShortcut(Qt::CTRL + Qt::Key_Z );
267 connect( a, SIGNAL( activated() ), e, SLOT( undo() ) );
268 editMenu->addAction (a);
272 a = new QAction(QPixmap(iconPath+"redo.png" ), tr( "&Redo" ),this);
273 a->setStatusTip ( tr( "Redo" ) );
274 a->setShortcut( Qt::CTRL + Qt::Key_Y );
275 connect( a, SIGNAL( activated() ), e, SLOT( redo() ) );
276 editMenu->addAction (a);
280 editMenu->addSeparator();
281 a = new QAction(QPixmap(), tr( "Select and copy &all" ),this);
282 a->setStatusTip ( tr( "Select and copy all" ) );
283 a->setShortcut( Qt::CTRL + Qt::Key_A );
284 connect( a, SIGNAL( activated() ), this, SLOT( editCopyAll() ) );
285 editMenu->addAction (a);
287 editMenu->addSeparator();
288 a = new QAction(QPixmap(iconPath+"editcopy.png" ), tr( "&Copy" ),this);
289 a->setStatusTip ( tr( "Copy" ) );
290 a->setShortcut( Qt::CTRL + Qt::Key_C );
291 connect( a, SIGNAL( activated() ), e, SLOT( copy() ) );
292 editMenu->addAction (a);
296 a = new QAction(QPixmap(iconPath+"editcut.png" ), tr( "Cu&t" ),this);
297 a->setStatusTip ( tr( "Cut" ) );
298 a->setShortcut( Qt::CTRL + Qt::Key_X );
299 connect( a, SIGNAL( activated() ), e, SLOT( cut() ) );
300 editMenu->addAction (a);
304 a = new QAction(QPixmap(iconPath+"editpaste.png" ), tr( "&Paste" ),this);
305 a->setStatusTip ( tr( "Paste" ) );
306 a->setShortcut( Qt::CTRL + Qt::Key_V );
307 connect( a, SIGNAL( activated() ), e, SLOT( paste() ) );
308 editMenu->addAction (a);
312 a = new QAction( QPixmap( iconPath+"edittrash.png"), tr( "&Delete All" ), this);
313 a->setStatusTip (tr( "Delete all" ) );
314 connect( a, SIGNAL( activated() ), e, SLOT( clear() ) );
315 editMenu->addAction (a);
317 actionEditDeleteAll=a;
321 void TextEditor::setupFormatActions()
323 QToolBar *tb = addToolBar ( tr("Format Actions" ));
324 tb->setObjectName ("noteEditorFormatActions");
325 QMenu *formatMenu = menuBar()->addMenu ( tr( "F&ormat" ));
329 a = new QAction( QPixmap(iconPath+"formatfixedfont.png"), tr( "&Font hint" ), Qt::ALT + Qt::Key_I, this, "fontHint" );
330 a->setStatusTip (tr( "Toggle font hint for the whole text" ) );
331 a->setToggleAction (true);
332 a->setOn (settings.value("/noteeditor/fonts/useFixedByDefault",false).toBool() );
333 connect( a, SIGNAL( activated() ), this, SLOT( toggleFonthint() ) );
334 formatMenu->addAction (a);
336 actionFormatUseFixedFont=a;
338 comboFont = new QComboBox;
339 tb->addWidget (comboFont);
340 QFontDatabase fontDB;
341 comboFont->insertStringList( fontDB.families() );
342 connect( comboFont, SIGNAL( activated( const QString & ) ),
343 this, SLOT( textFamily( const QString & ) ) );
344 comboFont->addItem( QApplication::font().family() );
345 comboSize = new QComboBox;
346 tb->addWidget (comboSize);
347 QList<int> sizes=fontDB.standardSizes();
348 QList<int>::iterator i = sizes.begin();
349 while (i != sizes.end())
351 ++i; // increment i before using it
352 comboSize->insertItem ( QString::number(*i));
354 connect( comboSize, SIGNAL( activated( const QString & ) ),
355 this, SLOT( textSize( const QString & ) ) );
356 comboSize->addItem ( QString::number( QApplication::font().pointSize() ) );
358 formatMenu->addSeparator();
360 QPixmap pix( 16, 16 );
361 pix.fill( e->color());
362 a = new QAction( pix, tr( "&Color..." ), this);
363 formatMenu->addAction (a);
365 connect( a, SIGNAL( activated() ), this, SLOT( textColor() ) );
368 a = new QAction( QPixmap (iconPath+"text_bold.png"), tr( "&Bold" ), this);
369 a->setShortcut(Qt::CTRL + Qt::Key_B );
370 connect( a, SIGNAL( activated() ), this, SLOT( textBold() ) );
372 formatMenu->addAction (a);
373 a->setToggleAction( true );
376 a = new QAction( QPixmap(iconPath+"text_italic.png"), tr( "&Italic" ), this);
377 a->setShortcut(Qt::CTRL + Qt::Key_I);
378 connect( a, SIGNAL( activated() ), this, SLOT( textItalic() ) );
380 formatMenu->addAction (a);
381 a->setToggleAction( true );
384 a = new QAction( QPixmap (iconPath+"text_under.png"), tr( "&Underline" ), this);
385 a->setShortcut(Qt::CTRL + Qt::Key_U );
386 connect( a, SIGNAL( activated() ), this, SLOT( textUnderline() ) );
388 formatMenu->addAction (a);
389 a->setToggleAction( true );
390 actionTextUnderline=a;
391 formatMenu->addSeparator();
393 QActionGroup *grp2 = new QActionGroup( this );
394 grp2->setExclusive(true);
395 a = new QAction( QPixmap (iconPath+"text_sub.png"), tr( "Subs&cript" ),grp2 );
396 a->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_B );
397 a->setToggleAction( true );
399 formatMenu->addAction (a);
400 connect(a, SIGNAL(activated()), this, SLOT(textVAlign()));
401 actionAlignSubScript=a;
403 a = new QAction( QPixmap (iconPath+"text_super.png"), tr( "Su&perscript" ),grp2 );
404 a->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_P );
405 a->setToggleAction( true );
407 formatMenu->addAction (a);
408 connect(a, SIGNAL(activated()), this, SLOT(textVAlign()));
409 actionAlignSuperScript=a;
410 QActionGroup *grp = new QActionGroup( this );
411 connect( grp, SIGNAL( selected( QAction* ) ), this, SLOT( textAlign( QAction* ) ) );
413 formatMenu->addSeparator();
415 a = new QAction( QPixmap (iconPath+"text_left.png"), tr( "&Left" ),grp );
416 a->setShortcut( Qt::CTRL+Qt::Key_L );
417 a->setToggleAction( true );
419 formatMenu->addAction (a);
421 a = new QAction( QPixmap (iconPath+"text_center.png"), tr( "C&enter" ),grp);
422 a->setShortcut( Qt::CTRL + Qt::Key_E);
423 a->setToggleAction( true );
425 formatMenu->addAction (a);
427 a = new QAction( QPixmap (iconPath+"text_right.png" ), tr( "&Right" ), grp);
428 a->setShortcut(Qt::CTRL + Qt::Key_R );
429 a->setToggleAction( true );
431 formatMenu->addAction (a);
433 a = new QAction( QPixmap ( iconPath+"text_block.png"), tr( "&Justify" ), grp );
434 a->setShortcut(Qt::CTRL + Qt::Key_J );
435 a->setToggleAction( true );
437 formatMenu->addAction (a);
438 actionAlignJustify=a;
441 void TextEditor::setupSettingsActions()
443 QMenu *settingsMenu = menuBar()->addMenu ( tr( "&Settings" ));
446 a = new QAction(tr( "Set &fixed font" ), this);
447 a->setStatusTip ( tr( "Set fixed font" ));
448 connect( a, SIGNAL( activated() ), this, SLOT( setFixedFont() ) );
449 settingsMenu->addAction (a);
450 actionSettingsFixedFont=a;
452 a = new QAction(tr( "Set &variable font" ), this);
453 a->setStatusTip ( tr( "Set variable font" ) );
454 connect( a, SIGNAL( activated() ), this, SLOT( setVarFont() ) );
455 settingsMenu->addAction (a);
456 actionSettingsVarFont=a;
458 a = new QAction(tr( "&fixed font is default" ), this);
459 a->setStatusTip (tr( "Used fixed font by default" ) );
460 a->setToggleAction (true);
461 // set state later in constructor...
462 settingsMenu->addAction (a);
463 actionSettingsFonthintDefault=a;
466 void TextEditor::textLoad()
468 if (state!=inactiveEditor)
470 if (e->text().length())
472 QMessageBox mb( __VYM " - " +tr("Note Editor"),
473 "Loading will overwrite the existing note",
474 QMessageBox::Warning,
475 QMessageBox::Yes | QMessageBox::Default,
478 mb.setButtonText( QMessageBox::Yes, "Load note" );
479 switch( mb.exec() ) {
480 case QMessageBox::Cancel:
486 QFileDialog *fd=new QFileDialog( this);
488 types<< "VYM notes (*.html)" <<
489 "ASCII texts (*.txt)" <<
491 fd->setFilters (types);
492 fd->setDirectory (QDir().current());
495 if ( fd->exec() == QDialog::Accepted )
496 fn = fd->selectedFile();
501 if ( !f.open( QIODevice::ReadOnly ) )
504 QTextStream ts( &f );
505 setText( ts.read() );
511 void TextEditor::closeEvent( QCloseEvent* ce )
513 ce->accept(); // TextEditor can be reopened with show()
514 actionViewToggleNoteEditor->setOn (false);
519 QString TextEditor::getText()
521 if (e->toPlainText().isEmpty())
527 void TextEditor::editorChanged()
534 if (state==emptyEditor)
535 setState (emptyEditor);
537 setState (filledEditor);
538 // SLOT is LinkableMapObj, which will update systemFlag
539 emit (textHasChanged() );
543 void TextEditor::setText(QString t)
545 e->setReadOnly(false);
550 void TextEditor::setInactive()
552 state=inactiveEditor;
554 setState (inactiveEditor);
555 e->setReadOnly (true);
560 void TextEditor::editCopyAll()
566 void TextEditor::textSaveAs()
568 QString fn = QFileDialog::getSaveFileName( QString::null, "VYM Note (HTML) (*.html);;All files (*)",
569 this,"export note dialog",tr("Export Note to single file") );
576 QMessageBox mb( __VYM,
577 tr("The file ") + fn +
578 tr(" exists already. "
579 "Do you want to overwrite it?"),
580 QMessageBox::Warning,
581 QMessageBox::Yes | QMessageBox::Default,
582 QMessageBox::Cancel | QMessageBox::Escape,
584 mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
585 mb.setButtonText( QMessageBox::No, tr("Cancel"));
586 switch( mb.exec() ) {
587 case QMessageBox::Yes:
592 case QMessageBox::Cancel:
603 statusBar()->message(tr( "Couldn't export note ") + fn, statusbarTime );
607 void TextEditor::textSave()
609 if ( filename.isEmpty() )
615 QString text = e->text();
617 if ( !f.open( QIODevice::WriteOnly ) )
619 statusBar()->message( QString("Could not write to %1").arg(filename),
628 e->setModified( FALSE );
630 statusBar()->message( QString( "Note exported as %1" ).arg( filename ), statusbarTime );
633 void TextEditor::textExportAsASCII()
635 QString text = NoteObj (e->text()).getNoteASCII();
637 if (!filenameHint.isEmpty())
639 if (!filenameHint.contains (".txt"))
640 s=filenameHint+".txt";
645 fn = QFileDialog::getSaveFileName( s, "VYM Note (ASCII) (*.txt);;All files (*)", this,"export note dialog",tr("Export Note to single file (ASCII)") );
653 QMessageBox mb( "VYM",
654 tr("The file ") + fn +
655 tr(" exists already. "
656 "Do you want to overwrite it?"),
657 QMessageBox::Warning,
658 QMessageBox::Yes | QMessageBox::Default,
659 QMessageBox::Cancel | QMessageBox::Escape,
661 mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
662 mb.setButtonText( QMessageBox::No, tr("Cancel"));
665 if (ret==QMessageBox::Cancel)
669 if ( !file.open( QIODevice::WriteOnly ) )
670 statusBar()->message( QString("Could not write to %1").arg(filename),
674 QTextStream t( &file );
678 statusBar()->message( QString( "Note exported as %1" ).arg( fn ), statusbarTime );
684 void TextEditor::textPrint()
687 QTextDocument *document = e->document();
690 QPrintDialog *dialog = new QPrintDialog(&printer, this);
691 dialog->setWindowTitle(tr("Print Document"));
692 if (dialog->exec() != QDialog::Accepted)
695 document->print(&printer);
698 void TextEditor::textEditUndo()
702 void TextEditor::toggleFonthint()
704 setUpdatesEnabled (false);
706 if (!actionFormatUseFixedFont->isOn() )
707 e->setCurrentFont (varFont);
709 e->setCurrentFont (fixedFont);
711 setUpdatesEnabled (true);
715 void TextEditor::setFixedFont()
718 QFont font =QFontDialog::getFont(
719 &ok, fixedFont, this );
721 // font is set to the font the user selected
725 void TextEditor::setVarFont()
728 QFont font =QFontDialog::getFont(
729 &ok, varFont, this );
731 // font is set to the font the user selected
735 void TextEditor::textBold()
737 e->setBold( actionTextBold->isOn() );
740 void TextEditor::textUnderline()
742 e->setUnderline( actionTextUnderline->isOn() );
745 void TextEditor::textItalic()
747 e->setItalic( actionTextItalic->isOn() );
750 void TextEditor::textFamily( const QString &f )
755 void TextEditor::textSize( const QString &p )
757 e->setPointSize( p.toInt() );
761 void TextEditor::textColor()
763 QColor col = QColorDialog::getColor( e->color(), this );
764 if ( !col.isValid() ) return;
766 QPixmap pix( 16, 16 );
767 pix.fill( Qt::black );
768 actionTextColor->setIconSet( pix );
771 void TextEditor::textAlign( QAction *a )
773 if ( a == actionAlignLeft )
774 e->setAlignment( Qt::AlignLeft );
775 else if ( a == actionAlignCenter )
776 e->setAlignment( Qt::AlignHCenter );
777 else if ( a == actionAlignRight )
778 e->setAlignment( Qt::AlignRight );
779 else if ( a == actionAlignJustify )
780 e->setAlignment( Qt::AlignJustify );
783 void TextEditor::textVAlign()
785 QTextCharFormat format;
787 if ( sender() == actionAlignSuperScript && actionAlignSuperScript->isOn()) {
788 format.setVerticalAlignment(QTextCharFormat::AlignSuperScript);
789 } else if (sender() == actionAlignSubScript && actionAlignSubScript->isOn()) {
790 format.setVerticalAlignment(QTextCharFormat::AlignSubScript);
792 format.setVerticalAlignment(QTextCharFormat::AlignNormal);
794 e->mergeCurrentCharFormat(format);
798 void TextEditor::fontChanged( const QFont &f )
800 int i=comboFont->findText(f.family());
801 if (i>=0) comboFont->setCurrentIndex (i);
802 i=comboSize->findText(QString::number(f.pointSize()));
803 if (i>=0) comboSize->setCurrentIndex(i);
804 actionTextBold->setOn( f.bold() );
805 actionTextItalic->setOn( f.italic() );
806 actionTextUnderline->setOn( f.underline() );
809 void TextEditor::colorChanged( const QColor &c )
811 QPixmap pix( 16, 16 );
813 actionTextColor->setIconSet( pix );
816 void TextEditor::formatChanged( const QTextCharFormat &f )
818 fontChanged(f.font());
819 colorChanged(f.foreground().color());
820 alignmentChanged(e->alignment());
821 verticalAlignmentChanged (f.verticalAlignment());
824 void TextEditor::alignmentChanged( int a )
826 if ( ( a == Qt::AlignLeft ) || ( a & Qt::AlignLeft ))
827 actionAlignLeft->setOn( true );
828 else if ( ( a & Qt::AlignHCenter ) )
829 actionAlignCenter->setOn( true );
830 else if ( ( a & Qt::AlignRight ) )
831 actionAlignRight->setOn( true );
832 else if ( ( a & Qt::AlignJustify ) )
833 actionAlignJustify->setOn( true );
836 void TextEditor::verticalAlignmentChanged(QTextCharFormat::VerticalAlignment a)
838 actionAlignSubScript->setOn (false);
839 actionAlignSuperScript->setOn (false);
842 case QTextCharFormat::AlignSuperScript:
843 actionAlignSuperScript->setOn (true);
845 case QTextCharFormat::AlignSubScript:
846 actionAlignSubScript->setOn (true);
854 void TextEditor::enableActions()
856 actionFileLoad->setEnabled(true);
857 actionFileSave->setEnabled(true);
858 actionFileSaveAs->setEnabled(true);
859 actionFilePrint->setEnabled(true);
860 actionEditUndo->setEnabled(true);
861 actionEditRedo->setEnabled(true);
862 actionEditCopy->setEnabled(true);
863 actionEditCut->setEnabled(true);
864 actionEditPaste->setEnabled(true);
865 actionEditDeleteAll->setEnabled(true);
866 actionFormatUseFixedFont->setEnabled(true);
869 void TextEditor::disableActions()
871 actionFileLoad->setEnabled(false);
872 actionFileSave->setEnabled(false);
873 actionFileSaveAs->setEnabled(false);
874 actionFilePrint->setEnabled(false);
875 actionEditUndo->setEnabled(false);
876 actionEditRedo->setEnabled(false);
877 actionEditCopy->setEnabled(false);
878 actionEditCut->setEnabled(false);
879 actionEditPaste->setEnabled(false);
880 actionEditDeleteAll->setEnabled(false);
881 actionFormatUseFixedFont->setEnabled(false);
884 void TextEditor::setState (EditorState s)
887 QPalette p=palette();
891 case emptyEditor: c=QColor (150,150,150); break;
892 case filledEditor: c=QColor (255,255,255); break;
893 case inactiveEditor: c=QColor (0,0,0);
895 p.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(9), c);
896 p.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(9), c);