2 #include "preferences.h"
3 #include "preferencedialog.h"
4 #include "ui_preferencedialog.h"
6 #include <QColorDialog>
10 #include <QFontDialog>
12 #include <QStandardPaths>
14 ///////////////////////////////////////////////////////////////////////////////
15 /// \brief PreferenceDialog::PreferenceDialog
16 /// \param parent 親ウィジェット
20 PreferenceDialog::PreferenceDialog(QWidget *parent) :
22 ui(new Ui::PreferenceDialog)
25 ui->tabWidget->setCurrentIndex(0);
26 ui->lBoxSample->setText(QDir::homePath());
27 ui->fvHiddenSample->installEventFilter(this);
28 ui->fvMarkedSample->installEventFilter(this);
29 ui->fvNormalSample->installEventFilter(this);
30 ui->fvReadOnlySample->installEventFilter(this);
31 ui->fvSystemSample->installEventFilter(this);
32 ui->lBoxSample->installEventFilter(this);
33 ui->sBoxNormalSample->installEventFilter(this);
34 ui->sBoxUnmatchSample->installEventFilter(this);
35 ui->tvSample->installEventFilter(this);
36 ui->hvSample->installEventFilter(this);
37 ui->gvSample->installEventFilter(this);
39 connect(ui->fvNormal, SIGNAL(clicked()), this, SLOT(chooseColor()));
40 connect(ui->fvNormalBg, SIGNAL(clicked()), this, SLOT(chooseColor()));
41 connect(ui->fvMarked, SIGNAL(clicked()), this, SLOT(chooseColor()));
42 connect(ui->fvMarkedBg, SIGNAL(clicked()), this, SLOT(chooseColor()));
43 connect(ui->fvSystem, SIGNAL(clicked()), this, SLOT(chooseColor()));
44 connect(ui->fvHidden, SIGNAL(clicked()), this, SLOT(chooseColor()));
45 connect(ui->fvReadOnly, SIGNAL(clicked()), this, SLOT(chooseColor()));
46 connect(ui->lBoxBg, SIGNAL(clicked()), this, SLOT(chooseColor()));
47 connect(ui->lBoxFg, SIGNAL(clicked()), this, SLOT(chooseColor()));
48 connect(ui->sBoxNormal, SIGNAL(clicked()), this, SLOT(chooseColor()));
49 connect(ui->sBoxNormalBg, SIGNAL(clicked()), this, SLOT(chooseColor()));
50 connect(ui->sBoxUnmatch, SIGNAL(clicked()), this, SLOT(chooseColor()));
51 connect(ui->sBoxUnmatchBg, SIGNAL(clicked()), this, SLOT(chooseColor()));
52 connect(ui->tvBg, SIGNAL(clicked()), this, SLOT(chooseColor()));
53 connect(ui->tvCtrl, SIGNAL(clicked()), this, SLOT(chooseColor()));
54 connect(ui->tvFg, SIGNAL(clicked()), this, SLOT(chooseColor()));
55 connect(ui->hvBg, SIGNAL(clicked()), this, SLOT(chooseColor()));
56 connect(ui->hvFg, SIGNAL(clicked()), this, SLOT(chooseColor()));
57 connect(ui->gvBg, SIGNAL(clicked()), this, SLOT(chooseColor()));
58 connect(ui->allBg, SIGNAL(clicked()), this, SLOT(chooseColor()));
59 connect(ui->allFg, SIGNAL(clicked()), this, SLOT(chooseColor()));
61 connect(ui->fvFont, SIGNAL(clicked()), this, SLOT(chooseFont()));
62 connect(ui->lBoxFont, SIGNAL(clicked()), this, SLOT(chooseFont()));
63 connect(ui->sBoxFont, SIGNAL(clicked()), this, SLOT(chooseFont()));
64 connect(ui->tvFont, SIGNAL(clicked()), this, SLOT(chooseFont()));
65 connect(ui->hvFont, SIGNAL(clicked()), this, SLOT(chooseFont()));
66 connect(ui->allFont, SIGNAL(clicked()), this, SLOT(chooseFont()));
68 connect(ui->browseArchiver, SIGNAL(clicked()), this, SLOT(choosePath()));
69 connect(ui->browseEditor, SIGNAL(clicked()), this, SLOT(choosePath()));
70 connect(ui->browseTerminal, SIGNAL(clicked()), this, SLOT(choosePath()));
72 connect(ui->exportAppearance, SIGNAL(clicked()), this, SLOT(exportAppearance()));
73 connect(ui->importAppearance, SIGNAL(clicked()), this, SLOT(importAppearance()));
75 Preferences prefs(this);
78 ui->checkUpdate->setChecked(prefs.isCheckUpdate());
79 ui->confirmQuit->setChecked(prefs.isConfirmQuit());
80 ui->moveAfterCreation->setChecked(prefs.isMoveAfterCreation());
81 ui->openAfterCreation->setChecked(prefs.isOpenAfterCreation());
82 ui->confirmCopy->setChecked(prefs.isConfirmCopy());
83 ui->confirmMove->setChecked(prefs.isConfirmMove());
84 ui->confirmDelete->setChecked(prefs.isConfirmDelete());
85 ui->confirmRename->setChecked(prefs.isConfirmRename());
86 ui->autoCloseCopy->setChecked(prefs.isAutoCloseCopy());
87 ui->autoCloseMove->setChecked(prefs.isAutoCloseMove());
88 ui->autoCloseDelete->setChecked(prefs.isAutoCloseDelete());
89 ui->autoCloseRename->setChecked(prefs.isAutoCloseRename());
90 QRadioButton *radio = findChild<QRadioButton*>("rb" + prefs.getCopyBehavior());
92 radio->setChecked(true);
94 ui->rbOverWriteIfNew->setChecked(true);
95 ui->preferExtensions->setPlainText(prefs.getPreferExtensions());
96 ui->resetOnBoot->setChecked(prefs.isReset());
99 loadAppearance(prefs);
102 setFont(ui->fvFontSpec, prefs.getFolderViewFont());
103 setFont(ui->lBoxFontSpec, prefs.getLocationBoxFont());
104 setFont(ui->sBoxFontSpec, prefs.getSearchBoxFont());
105 setFont(ui->tvFontSpec, prefs.getTextViewFont());
106 setFont(ui->hvFontSpec, prefs.getHexViewFont());
108 ui->lineHeight->setValue(prefs.getLineHeight());
109 ui->tvLineHeight->setValue(prefs.getTextViewLineHeight());
112 ui->editorPath->setText(prefs.getEditorPath());
113 ui->terminalPath->setText(prefs.getTerminalPath());
114 ui->archiverPath->setText(prefs.getArchiverPath());
117 ///////////////////////////////////////////////////////////////////////////////
118 /// \brief PreferenceDialog::~PreferenceDialog
122 PreferenceDialog::~PreferenceDialog()
127 ///////////////////////////////////////////////////////////////////////////////
128 /// \brief PreferenceDialog::loadAppearance
129 /// \param prefs プリファレンスオブジェクト
133 void PreferenceDialog::loadAppearance(Preferences &prefs)
135 setPalette(ui->fvNormalSample, QPalette::Base, prefs.getFolderViewBgColor());
136 setPalette(ui->fvNormalSample, QPalette::Text, prefs.getFolderViewFgColor());
138 setPalette(ui->fvMarkedSample, QPalette::Base, prefs.getFolderViewMarkedBgColor());
139 setPalette(ui->fvMarkedSample, QPalette::Text, prefs.getFolderViewMarkedFgColor());
141 setPalette(ui->fvSystemSample, QPalette::Base, prefs.getFolderViewBgColor());
142 setPalette(ui->fvSystemSample, QPalette::Text, prefs.getFolderViewSystemColor());
144 setPalette(ui->fvHiddenSample, QPalette::Base, prefs.getFolderViewBgColor());
145 setPalette(ui->fvHiddenSample, QPalette::Text, prefs.getFolderViewHiddenColor());
147 setPalette(ui->fvReadOnlySample, QPalette::Base, prefs.getFolderViewBgColor());
148 setPalette(ui->fvReadOnlySample, QPalette::Text, prefs.getFolderViewReadOnlyColor());
150 setPalette(ui->lBoxSample, QPalette::Base, prefs.getLocationBoxBgColor());
151 setPalette(ui->lBoxSample, QPalette::Text, prefs.getLocationBoxFgColor());
153 setPalette(ui->sBoxNormalSample, QPalette::Base, prefs.getSearchBoxBgColor());
154 setPalette(ui->sBoxNormalSample, QPalette::Text, prefs.getSearchBoxFgColor());
156 setPalette(ui->sBoxUnmatchSample, QPalette::Base, prefs.getSearchBoxUnmatchBgColor());
157 setPalette(ui->sBoxUnmatchSample, QPalette::Text, prefs.getSearchBoxUnmatchFgColor());
159 setPalette(ui->tvSample, QPalette::Base, prefs.getTextViewBgColor());
160 setPalette(ui->tvSample, QPalette::Text, prefs.getTextViewFgColor());
161 setPalette(ui->tvSample, QPalette::BrightText, prefs.getTextViewCtrlColor());
163 setPalette(ui->hvSample, QPalette::Base, prefs.getHexViewBgColor());
164 setPalette(ui->hvSample, QPalette::Text, prefs.getHexViewFgColor());
166 setPalette(ui->gvSample, QPalette::Base, prefs.getImageViewBgColor());
168 ui->darkFactor->setValue(prefs.getDarkFacotr());
171 ///////////////////////////////////////////////////////////////////////////////
172 /// \brief PreferenceDialog::saveAppearance
173 /// \param prefs プリファレンスオブジェクト
177 void PreferenceDialog::saveAppearance(Preferences &prefs)
179 prefs.setFolderViewBgColor(ui->fvNormalSample->palette().base().color());
180 prefs.setFolderViewFgColor(ui->fvNormalSample->palette().text().color());
182 prefs.setFolderViewMarkedBgColor(ui->fvMarkedSample->palette().base().color());
183 prefs.setFolderViewMarkedFgColor(ui->fvMarkedSample->palette().text().color());
185 prefs.setFolderViewHiddenColor(ui->fvHiddenSample->palette().text().color());
186 prefs.setFolderViewReadOnlyColor(ui->fvReadOnlySample->palette().text().color());
187 prefs.setFolderViewSystemColor(ui->fvSystemSample->palette().text().color());
189 prefs.setLocationBoxBgColor(ui->lBoxSample->palette().base().color());
190 prefs.setLocationBoxFgColor(ui->lBoxSample->palette().text().color());
192 prefs.setSearchBoxBgColor(ui->sBoxNormalSample->palette().base().color());
193 prefs.setSearchBoxFgColor(ui->sBoxNormalSample->palette().text().color());
195 prefs.setSearchBoxUnmatchBgColor(ui->sBoxUnmatchSample->palette().base().color());
196 prefs.setSearchBoxUnmatchFgColor(ui->sBoxUnmatchSample->palette().text().color());
198 prefs.setTextViewBgColor(ui->tvSample->palette().base().color());
199 prefs.setTextViewFgColor(ui->tvSample->palette().text().color());
200 prefs.setTextViewCtrlColor(ui->tvSample->palette().brightText().color());
202 prefs.setHexViewBgColor(ui->hvSample->palette().base().color());
203 prefs.setHexViewFgColor(ui->hvSample->palette().text().color());
205 prefs.setImageViewBgColor(ui->gvSample->palette().base().color());
207 prefs.setDarkFacotr(ui->darkFactor->value());
210 ///////////////////////////////////////////////////////////////////////////////
211 /// \brief PreferenceDialog::setFont
212 /// \param label ラベルオブジェクト
213 /// \param font フォントオブジェクト
217 void PreferenceDialog::setFont(QLabel *label, const QFont &font)
219 label->setFont(font);
220 label->setText(QString("%1, %2pt").arg(font.family()).arg(font.pointSize()));
223 ///////////////////////////////////////////////////////////////////////////////
224 /// \brief PreferenceDialog::setPalette
231 void PreferenceDialog::setPalette(QWidget *w, QPalette::ColorRole role, const QColor &color)
233 QPalette pal = w->palette();
234 pal.setColor(role, color);
238 ///////////////////////////////////////////////////////////////////////////////
239 /// \brief PreferenceDialog::chooseColor
243 void PreferenceDialog::chooseColor()
247 if (sender() == ui->fvNormal) {
248 color = ui->fvNormalSample->palette().text().color();
250 else if (sender() == ui->fvNormalBg) {
251 color = ui->fvNormalSample->palette().base().color();
253 else if (sender() == ui->fvMarked) {
254 color = ui->fvMarkedSample->palette().text().color();
256 else if (sender() == ui->fvMarkedBg) {
257 color = ui->fvMarkedSample->palette().base().color();
259 else if (sender() == ui->fvSystem) {
260 color = ui->fvSystemSample->palette().text().color();
262 else if (sender() == ui->fvHidden) {
263 color = ui->fvHiddenSample->palette().text().color();
265 else if (sender() == ui->fvReadOnly) {
266 color = ui->fvReadOnlySample->palette().text().color();
268 else if (sender() == ui->lBoxBg) {
269 color = ui->lBoxSample->palette().base().color();
271 else if (sender() == ui->lBoxFg) {
272 color = ui->lBoxSample->palette().text().color();
274 else if (sender() == ui->sBoxNormal) {
275 color = ui->sBoxNormalSample->palette().text().color();
277 else if (sender() == ui->sBoxNormalBg) {
278 color = ui->sBoxNormalSample->palette().base().color();
280 else if (sender() == ui->sBoxUnmatch) {
281 color = ui->sBoxUnmatchSample->palette().text().color();
283 else if (sender() == ui->sBoxUnmatchBg) {
284 color = ui->sBoxUnmatchSample->palette().base().color();
286 else if (sender() == ui->tvBg) {
287 color = ui->tvSample->palette().base().color();
289 else if (sender() == ui->tvFg) {
290 color = ui->tvSample->palette().text().color();
292 else if (sender() == ui->tvCtrl) {
293 color = ui->tvSample->palette().brightText().color();
295 else if (sender() == ui->hvBg) {
296 color = ui->hvSample->palette().base().color();
298 else if (sender() == ui->hvFg) {
299 color = ui->hvSample->palette().text().color();
301 else if (sender() == ui->gvBg) {
302 color = ui->gvSample->palette().base().color();
304 else if (sender() == ui->allBg) {
305 color = ui->fvNormalSample->palette().base().color();
307 else if (sender() == ui->allFg) {
308 color = ui->fvNormalSample->palette().text().color();
311 color = QColorDialog::getColor(color, this, tr("色を選択"));
312 if (!color.isValid()) {
317 if (sender() == ui->fvNormal) {
318 setPalette(ui->fvNormalSample, QPalette::Text, color);
320 else if (sender() == ui->fvNormalBg) {
321 setPalette(ui->fvNormalSample, QPalette::Base, color);
322 setPalette(ui->fvHiddenSample, QPalette::Base, color);
323 setPalette(ui->fvReadOnlySample, QPalette::Base, color);
324 setPalette(ui->fvSystemSample, QPalette::Base, color);
326 else if (sender() == ui->fvMarked) {
327 setPalette(ui->fvMarkedSample, QPalette::Text, color);
329 else if (sender() == ui->fvMarkedBg) {
330 setPalette(ui->fvMarkedSample, QPalette::Base, color);
332 else if (sender() == ui->fvSystem) {
333 setPalette(ui->fvSystemSample, QPalette::Text, color);
335 else if (sender() == ui->fvHidden) {
336 setPalette(ui->fvHiddenSample, QPalette::Text, color);
338 else if (sender() == ui->fvReadOnly) {
339 setPalette(ui->fvReadOnlySample, QPalette::Text, color);
341 else if (sender() == ui->lBoxBg) {
342 setPalette(ui->lBoxSample, QPalette::Base, color);
344 else if (sender() == ui->lBoxFg) {
345 setPalette(ui->lBoxSample, QPalette::Text, color);
347 else if (sender() == ui->sBoxNormal) {
348 setPalette(ui->sBoxNormalSample, QPalette::Text, color);
350 else if (sender() == ui->sBoxNormalBg) {
351 setPalette(ui->sBoxNormalSample, QPalette::Base, color);
353 else if (sender() == ui->sBoxUnmatch) {
354 setPalette(ui->sBoxUnmatchSample, QPalette::Text, color);
356 else if (sender() == ui->sBoxUnmatchBg) {
357 setPalette(ui->sBoxUnmatchSample, QPalette::Base, color);
359 else if (sender() == ui->tvBg) {
360 setPalette(ui->tvSample, QPalette::Base, color);
362 else if (sender() == ui->tvFg) {
363 setPalette(ui->tvSample, QPalette::Text, color);
365 else if (sender() == ui->tvCtrl) {
366 setPalette(ui->tvSample, QPalette::BrightText, color);
368 else if (sender() == ui->hvBg) {
369 setPalette(ui->hvSample, QPalette::Base, color);
371 else if (sender() == ui->hvFg) {
372 setPalette(ui->hvSample, QPalette::Text, color);
374 else if (sender() == ui->gvBg) {
375 setPalette(ui->gvSample, QPalette::Base, color);
377 else if (sender() == ui->allBg) {
378 setPalette(ui->fvNormalSample, QPalette::Base, color);
379 setPalette(ui->fvHiddenSample, QPalette::Base, color);
380 setPalette(ui->fvReadOnlySample, QPalette::Base, color);
381 setPalette(ui->fvSystemSample, QPalette::Base, color);
382 setPalette(ui->lBoxSample, QPalette::Base, color);
383 setPalette(ui->sBoxNormalSample, QPalette::Base, color);
384 setPalette(ui->tvSample, QPalette::Base, color);
385 setPalette(ui->hvSample, QPalette::Base, color);
386 setPalette(ui->gvSample, QPalette::Base, color);
388 else if (sender() == ui->allFg) {
389 setPalette(ui->fvNormalSample, QPalette::Text, color);
390 setPalette(ui->lBoxSample, QPalette::Text, color);
391 setPalette(ui->sBoxNormalSample, QPalette::Text, color);
392 setPalette(ui->tvSample, QPalette::Text, color);
393 setPalette(ui->hvSample, QPalette::Text, color);
397 ///////////////////////////////////////////////////////////////////////////////
398 /// \brief PreferenceDialog::chooseFont
400 /// フォント選択ダイアログを表示します。
402 void PreferenceDialog::chooseFont()
405 if (sender() == ui->fvFont) {
406 font = ui->fvFontSpec->font();
408 else if (sender() == ui->lBoxFont) {
409 font = ui->lBoxFontSpec->font();
411 else if (sender() == ui->sBoxFont) {
412 font = ui->sBoxFontSpec->font();
414 else if (sender() == ui->tvFont) {
415 font = ui->tvFontSpec->font();
417 else if (sender() == ui->hvFont) {
418 font = ui->hvFontSpec->font();
420 else if (sender() == ui->allFont) {
421 font = ui->fvFontSpec->font();
425 font = QFontDialog::getFont(&ok, font, this, tr("フォントを選択"));
431 if (sender() == ui->fvFont) {
432 setFont(ui->fvFontSpec, font);
434 else if (sender() == ui->lBoxFont) {
435 setFont(ui->lBoxFontSpec, font);
437 else if (sender() == ui->sBoxFont) {
438 setFont(ui->sBoxFontSpec, font);
440 else if (sender() == ui->tvFont) {
441 setFont(ui->tvFontSpec, font);
443 else if (sender() == ui->hvFont) {
444 setFont(ui->hvFontSpec, font);
446 else if (sender() == ui->allFont) {
447 setFont(ui->fvFontSpec, font);
448 setFont(ui->lBoxFontSpec, font);
449 setFont(ui->sBoxFontSpec, font);
450 setFont(ui->tvFontSpec, font);
451 setFont(ui->hvFontSpec, font);
455 ///////////////////////////////////////////////////////////////////////////////
456 /// \brief PreferenceDialog::choosePath
458 /// プログラム選択ダイアログを表示します。
460 void PreferenceDialog::choosePath()
462 QStringList list = QStandardPaths::standardLocations(
463 QStandardPaths::ApplicationsLocation);
465 QString path = QFileDialog::getOpenFileName(
466 this, tr("アプリケーションを選択"), getenv("PROGRAMFILES"),
467 tr("実行ファイル (*.exe *.com *.bat *.pif);;すべてのファイル (*)"));
468 #elif defined(Q_OS_MAC)
469 QString path = QFileDialog::getOpenFileName(
470 this, tr("アプリケーションを選択"), list.at(0),
471 tr("実行ファイル (*.app);;すべてのファイル (*)"));
473 QString path = QFileDialog::getOpenFileName(
474 this, tr("アプリケーションを選択"), list.at(0),
477 if (path.isEmpty()) {
481 if (path.indexOf(" ") != -1) {
485 if (sender() == ui->browseEditor) {
486 ui->editorPath->setText(path);
488 else if (sender() == ui->browseTerminal) {
489 ui->terminalPath->setText(path);
491 else if (sender() == ui->browseArchiver) {
492 ui->archiverPath->setText(path);
496 ///////////////////////////////////////////////////////////////////////////////
497 /// \brief PreferenceDialog::exportAppearance
499 /// 「エクスポート」ボタンクリック時の処理を行います。
501 void PreferenceDialog::exportAppearance()
503 QStringList list = QStandardPaths::standardLocations(
504 QStandardPaths::DocumentsLocation);
505 QString path = QFileDialog::getSaveFileName(
506 this, tr("ファイルを選択"), list.at(0) + "/gefu_appearance.ini",
507 tr("設定ファイル (*.ini);;すべてのファイル (*)"));
508 if (path.isEmpty()) {
512 Preferences prefs(path, this);
513 saveAppearance(prefs);
516 ///////////////////////////////////////////////////////////////////////////////
517 /// \brief PreferenceDialog::importAppearance
519 /// 「インポート」ボタンクリック時の処理を行います。
521 void PreferenceDialog::importAppearance()
523 QStringList list = QStandardPaths::standardLocations(
524 QStandardPaths::DocumentsLocation);
525 QString path = QFileDialog::getOpenFileName(
526 this, tr("ファイルを選択"), list.at(0),
527 tr("設定ファイル (*.ini);;すべてのファイル (*)"));
528 if (path.isEmpty()) {
532 Preferences prefs(path, this);
533 loadAppearance(prefs);
536 ///////////////////////////////////////////////////////////////////////////////
537 /// \brief PreferenceDialog::accept
539 /// OKボタンクリック時の処理を行います。
541 void PreferenceDialog::accept()
543 Preferences prefs(this);
546 prefs.setCheckUpdate(ui->checkUpdate->isChecked());
547 prefs.setConfirmQuit(ui->confirmQuit->isChecked());
548 prefs.setMoveAfterCreation(ui->moveAfterCreation->isChecked());
549 prefs.setOpenAfterCreation(ui->openAfterCreation->isChecked());
550 prefs.setConfirmCopy(ui->confirmCopy->isChecked());
551 prefs.setConfirmMove(ui->confirmMove->isChecked());
552 prefs.setConfirmDelete(ui->confirmDelete->isChecked());
553 prefs.setConfirmRename(ui->confirmRename->isChecked());
554 prefs.setAutoCloseCopy(ui->autoCloseCopy->isChecked());
555 prefs.setAutoCloseMove(ui->autoCloseMove->isChecked());
556 prefs.setAutoCloseDelete(ui->autoCloseDelete->isChecked());
557 prefs.setAutoCloseRename(ui->autoCloseRename->isChecked());
559 QAbstractButton *checked = ui->copyBehavior->checkedButton();
560 prefs.setCopyBehavior(checked->objectName().mid(2));
562 prefs.setPreferExtensions(ui->preferExtensions->toPlainText());
563 prefs.setReset(ui->resetOnBoot->isChecked());
566 saveAppearance(prefs);
569 prefs.setFolderViewFont(ui->fvFontSpec->font());
570 prefs.setLocationBoxFont(ui->lBoxFontSpec->font());
571 prefs.setSearchBoxFont(ui->sBoxFontSpec->font());
572 prefs.setTextViewFont(ui->tvFontSpec->font());
573 prefs.setHexViewFont(ui->hvFontSpec->font());
575 prefs.setLineHeight(ui->lineHeight->value());
576 prefs.setTextViewLineHeight(ui->tvLineHeight->value());
579 prefs.setEditorPath(ui->editorPath->text());
580 prefs.setTerminalPath(ui->terminalPath->text());
581 prefs.setArchiverPath(ui->archiverPath->text());
586 ///////////////////////////////////////////////////////////////////////////////
587 /// \brief PreferenceDialog::eventFilter
588 /// \param obj イベントが発生したオブジェクト
589 /// \param event イベントオブジェクト
590 /// \return イベントを処理した場合はtrueを返します。
592 bool PreferenceDialog::eventFilter(QObject *obj, QEvent *event)
594 if (event->type() == QEvent::Paint) {
595 QLineEdit *edit = static_cast<QLineEdit*>(obj);
597 QPainter painter(edit);
599 painter.fillRect(edit->rect(), edit->palette().base());
600 painter.setPen(edit->palette().text().color());
601 painter.drawText(edit->rect(), Qt::AlignVCenter, edit->text());
603 if (edit->objectName() == "tvSample") {
604 QRect rcCtrl(edit->rect());
605 int textWidth = edit->fontMetrics().width(edit->text());
606 rcCtrl.setLeft(edit->rect().left() + textWidth);
607 painter.setPen(edit->palette().brightText().color());
608 painter.drawText(rcCtrl, Qt::AlignVCenter, QChar(0x21B5));