Пример #1
0
LineEdit::LineEdit(QWidget *parent) :
	SearchBar(parent), _timer(new QTimer(this)), _fps(0)
{
	this->setAttribute(Qt::WA_MacShowFocusRect, false);

	_timer->setInterval(40);
	connect(_timer, &QTimer::timeout, [=]() {
		_fps++;
		if (_fps == 25) {
			_fps = 0;
		}
		this->repaint();
	});

	_fade.setEasingCurve(QEasingCurve::Linear);
	QPalette p = QApplication::palette();
	_fade.setStartValue(p.text().color());
	_fade.setKeyValueAt(0.5, p.base().color());
	_fade.setEndValue(p.text().color());
	_fade.setDuration(1000);

	connect(qApp, &QApplication::paletteChanged, this, [=](const QPalette &p) {
		_fade.setStartValue(p.text().color());
		_fade.setKeyValueAt(0.5, p.base().color());
		_fade.setEndValue(p.text().color());
	});
}
Пример #2
0
void TextOutput::loadColorStyleScheme()
{
    bool useColorShceme = m_liteApp->settings()->value(TEXTOUTPUT_USECOLORSCHEME,true).toBool();

    const ColorStyleScheme *colorScheme = m_liteApp->editorManager()->colorStyleScheme();
    const ColorStyle *text = colorScheme->findStyle("Text");
    const ColorStyle *selection = colorScheme->findStyle("Selection");
    const ColorStyle *keyword = colorScheme->findStyle("Keyword");
    const ColorStyle *error = colorScheme->findStyle("Error");

    QPalette p = this->m_defPalette;
    if (useColorShceme && text) {
        if (text->foregound().isValid()) {
            p.setColor(QPalette::Text,text->foregound());
            p.setColor(QPalette::Foreground, text->foregound());
        }
        if (text->background().isValid()) {
            p.setColor(QPalette::Base, text->background());
        }
    }
    if (useColorShceme && selection) {
        if (selection->foregound().isValid()) {
            p.setColor(QPalette::HighlightedText, selection->foregound());
        }
        if (selection->background().isValid()) {
            p.setColor(QPalette::Highlight, selection->background());
        }
        p.setBrush(QPalette::Inactive, QPalette::Highlight, p.highlight());
        p.setBrush(QPalette::Inactive, QPalette::HighlightedText, p.highlightedText());
    }

    QString sheet = QString("QPlainTextEdit{color:%1;background-color:%2;selection-color:%3;selection-background-color:%4;}")
                .arg(p.text().color().name())
                .arg(p.base().color().name())
                .arg(p.highlightedText().color().name())
                .arg(p.highlight().color().name());
    this->setPalette(p);
    this->setStyleSheet(sheet);

    m_clrText = p.text().color();

    m_fmt.setForeground(p.text().color());
    m_fmt.setBackground(p.base().color());

    if (useColorShceme && keyword && keyword->foregound().isValid()) {
        m_clrTag = keyword->foregound();
    } else {
        m_clrTag = Qt::darkBlue;
    }
    if (useColorShceme && error && error->foregound().isValid()) {
        m_clrError = error->foregound();
    } else {
        m_clrError = Qt::red;
    }
    this->updateExistsTextColor();
}
Пример #3
0
/** Redefined. */
void PlaylistHeaderView::paintEvent(QPaintEvent *)
{
	QStylePainter p(this->viewport());

	QLinearGradient vLinearGradient(rect().topLeft(), QPoint(rect().left(), rect().top() + rect().height()));
	/// XXX
	QPalette palette = QApplication::palette();
	if (SettingsPrivate::instance()->isCustomColors()) {
		vLinearGradient.setColorAt(0, palette.base().color().lighter(110));
		vLinearGradient.setColorAt(1, palette.base().color());
	} else {
		vLinearGradient.setColorAt(0, palette.base().color());
		vLinearGradient.setColorAt(1, palette.window().color());
	}

	QStyleOptionHeader opt;
	opt.initFrom(this->viewport());
	p.fillRect(rect(), QBrush(vLinearGradient));
	p.setPen(opt.palette.windowText().color());
	QRect r;
	p.save();
	if (QGuiApplication::isLeftToRight()) {
		p.translate(-offset(), 0);
	} else {
		p.translate(offset(), 0);
	}
	for (int i = 0; i < count(); i++) {
		QRect r2(sectionPosition(i), viewport()->rect().y(), sectionSize(i), viewport()->rect().height());
		p.drawText(r2, Qt::AlignCenter, model()->headerData(i, Qt::Horizontal).toString());
		if (r2.contains(mapFromGlobal(QCursor::pos()))) {
			r = r2;
		}
	}
	p.restore();
	if (!r.isNull()) {
		p.save();
		p.setPen(palette.highlight().color());
		p.drawLine(r.x(), r.y() + r.height() / 4,
				   r.x(), r.y() + 3 * r.height() / 4);
		p.drawLine(r.x() + r.width() - 1, r.y() + r.height() / 4,
				   r.x() + r.width() - 1, r.y() + 3 * r.height() / 4);
		p.restore();
	}

	// Bottom frame
	p.setPen(QApplication::palette().mid().color());
	p.drawLine(rect().bottomLeft(),  QPoint(rect().left() + rect().width(), rect().top() + rect().height()));

	// Vertical frame
	if (QGuiApplication::isLeftToRight()) {
		p.drawLine(rect().topLeft(), QPoint(rect().left(), rect().top() + rect().height()));
	} else {
		p.drawLine(rect().topRight(), QPoint(rect().right(), rect().top() + rect().height()));
	}
}
Пример #4
0
void GenericCodeEditor::applySettings( Settings::Manager *settings )
{
    settings->beginGroup("IDE/editor");

    bool lineWrap = settings->value("lineWrap").toBool();
    bool showWhitespace = settings->value("showWhitespace").toBool();
    bool showLinenumber = settings->value("showLinenumber").toBool();
    mInactiveFadeAlpha = settings->value("inactiveEditorFadeAlpha").toInt();

    QPalette palette;

    const QTextCharFormat *format = &settings->getThemeVal("text");
    QBrush bg = format->background();
    QBrush fg = format->foreground();
    if (bg.style() != Qt::NoBrush)
        palette.setBrush(QPalette::Base, bg);
    if (fg.style() != Qt::NoBrush)
        palette.setBrush(QPalette::Text, fg);

    // NOTE: the line number widget will inherit the palette from the editor
    format = &settings->getThemeVal("lineNumbers");
    mLineIndicator->setFont(format->font());
    bg = format->background();
    fg = format->foreground();
    palette.setBrush(QPalette::Mid,
                            bg.style() != Qt::NoBrush ? bg : palette.base());
    palette.setBrush(QPalette::ButtonText,
                            fg.style() != Qt::NoBrush ? fg : palette.base());

    format = &settings->getThemeVal("selection");
    bg = format->background();
    fg = format->foreground();
    if (bg.style() != Qt::NoBrush)
        palette.setBrush(QPalette::Highlight, bg);
    if (fg.style() != Qt::NoBrush)
        palette.setBrush(QPalette::HighlightedText, fg);

    mCurrentLineTextFormat = settings->getThemeVal("currentLine");
    mSearchResultTextFormat = settings->getThemeVal("searchResult");

    mHighlightCurrentLine = settings->value("highlightCurrentLine").toBool();
    updateCurrentLineHighlighting();

    settings->endGroup(); // IDE/editor

    setLineWrapMode( lineWrap ? QPlainTextEdit::WidgetWidth : QPlainTextEdit::NoWrap );
    setShowWhitespace( showWhitespace );
    setShowLinenumber( showLinenumber );
    mLineIndicator->setLineCount(blockCount());
    setPalette(palette);
    
    setActiveAppearance(hasFocus());
}
Пример #5
0
void KstMatrixTable::paintCell( QPainter* painter, int row, int col, const QRect& cr, bool selected, const QPalette &palette ) {
  KstMatrixPtr matrix = *KST::matrixList.findTag(_strMatrix);
  QString str;
  double value;

  painter->eraseRect( 0, 0, cr.width(), cr.height() );
  if (selected) {
    painter->fillRect( 0, 0, cr.width(), cr.height(), palette.highlight() );
    painter->setPen(palette.highlightedText().color());
  } else {
    painter->fillRect( 0, 0, cr.width(), cr.height(), palette.base() );
    painter->setPen(palette.text().color());
  }

  if (matrix) {
    bool ok;
    value = matrix->valueRaw(col, row, &ok);
    if (ok) {
      str.setNum(value, 'g', 16);
    } else {
      str = "-";
    }
  }

  painter->drawText(0, 0, cr.width(), cr.height(), Qt::AlignLeft, str);
}
Пример #6
0
static void drawRectBox(QPainter *painter, const QRect &rect, bool start, bool end,
                        const QPalette &pal)
{
    painter->save();
    painter->setRenderHint(QPainter::Antialiasing, false);

    QRgb b = pal.base().color().rgb();
    QRgb h = pal.highlight().color().rgb();
    QColor c = StyleHelper::mergedColors(b,h, 50);

    QLinearGradient grad(rect.topLeft(), rect.topRight());
    grad.setColorAt(0, c.lighter(110));
    grad.setColorAt(1, c.lighter(130));
    QColor outline = c;

    painter->fillRect(rect, grad);
    painter->setPen(outline);
    if (start)
        painter->drawLine(rect.topLeft() + QPoint(1, 0), rect.topRight() -  QPoint(1, 0));
    if (end)
        painter->drawLine(rect.bottomLeft() + QPoint(1, 0), rect.bottomRight() -  QPoint(1, 0));

    painter->drawLine(rect.topRight() + QPoint(0, start ? 1 : 0), rect.bottomRight() - QPoint(0, end ? 1 : 0));
    painter->drawLine(rect.topLeft() + QPoint(0, start ? 1 : 0), rect.bottomLeft() - QPoint(0, end ? 1 : 0));

    painter->restore();
}
Пример #7
0
    void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const {
        if (option.state & QStyle::State_Selected) {
            painter->fillRect(option.rect, option.palette.color(QPalette::Highlight));
            painter->setPen(option.palette.color(QPalette::HighlightedText));
        }

        QString text = index.data(Qt::DisplayRole).toString();
        QRect r = option.rect.adjusted(option.rect.height() + 4, 0, -4 - option.rect.height(), 0);
        painter->drawText(r, Qt::AlignVCenter | Qt::AlignLeft, text, &r);
        QColor swatch_color = index.data(Qt::UserRole).value<QColor>();

        if (!swatch_color.isValid()) {
            // Special cases for colors we want to come from the system
            QPalette defaultPalette;

            if (text == QString(tr("Background"))) {
                swatch_color = defaultPalette.base().color();
            } else if (text == QString(tr("Foreground"))) {
                swatch_color = defaultPalette.windowText().color();
            } else if (text == QString(tr("Selection Background"))) {
                swatch_color = defaultPalette.highlight().color();
            } else if (text == QString(tr("Selection Foreground"))) {
                swatch_color = defaultPalette.highlightedText().color();
            }
        }

        r = option.rect.adjusted(1, 1, option.rect.height() - option.rect.width(), -2);
        painter->setPen(Qt::black);
        painter->setBrush(swatch_color);
        painter->drawRect(r);
    }
Пример #8
0
/** Redefined to display user input like closable "bubbles". */
void TagLineEdit::paintEvent(QPaintEvent *)
{
	QStylePainter p(this);

	// Draw frame
	QStyleOptionFrameV3 frame;
	this->initStyleOption(&frame);
	QPalette palette = QApplication::palette();
	p.setPen(palette.mid().color());
	p.setBrush(palette.base());
	p.drawRect(this->rect().adjusted(0, 0, -1, -1));

	// Compute cursor position
	QRect contentsRect = this->style()->subElementRect(QStyle::SE_LineEditContents, &frame);
	QRect rText = contentsRect.adjusted(2, 0, 0, 0);
	if (!_tags.isEmpty() || (placeholderText().isEmpty() || (!placeholderText().isEmpty() && hasFocus()))) {
		p.setPen(palette.text().color());
		p.drawText(rText, Qt::AlignLeft | Qt::AlignVCenter, text());

		// Animate cursor is focus is owned by this widget
		bool overlap = false;
		for (TagButton *t : _tags) {
			if (t->frameGeometry().contains(cursorRect().center())) {
				overlap = true;
				break;
			}
		}
		if (!overlap && hasFocus()) {
			this->drawCursor(&p, rText.adjusted(0, 1, 0, -1));
		}
	} else {
		p.setPen(palette.mid().color());
		p.drawText(rText, Qt::AlignLeft | Qt::AlignVCenter, placeholderText());
	}
}
Пример #9
0
void ItemText::highlight(const QRegExp &re, const QFont &highlightFont, const QPalette &highlightPalette)
{
    QList<QTextBrowser::ExtraSelection> selections;

    if ( !re.isEmpty() ) {
        QTextBrowser::ExtraSelection selection;
        selection.format.setBackground( highlightPalette.base() );
        selection.format.setForeground( highlightPalette.text() );
        selection.format.setFont(highlightFont);

        QTextCursor cur = m_textDocument.find(re);
        int a = cur.position();
        while ( !cur.isNull() ) {
            if ( cur.hasSelection() ) {
                selection.cursor = cur;
                selections.append(selection);
            } else {
                cur.movePosition(QTextCursor::NextCharacter);
            }
            cur = m_textDocument.find(re, cur);
            int b = cur.position();
            if (a == b) {
                cur.movePosition(QTextCursor::NextCharacter);
                cur = m_textDocument.find(re, cur);
                b = cur.position();
                if (a == b) break;
            }
            a = b;
        }
    }

    setExtraSelections(selections);

    update();
}
void KTModuleWidgetBase::enterEvent(QEvent *e)
{
    Q_UNUSED(e);
    QPalette pal = palette();
    pal.setBrush(QPalette::Background, pal.highlight ());
    pal.setBrush(QPalette::Text, pal.base ());
    m_title->setPalette(pal);
}
Пример #11
0
void QDeclarativeWebView::setBackgroundColor(const QColor& color)
{
    QPalette palette = d->view->palette();
    if (palette.base().color() == color)
        return;
    palette.setBrush(QPalette::Base, color);
    d->view->setPalette(palette);
    emit backgroundColorChanged();
}
Пример #12
0
void ConsoleWindow::addNewConsoleItem(QStandardItem *item)
{
    QSettings settings;
    settings.beginGroup("Console");
    QPalette palette = settings.value(QString("log-level-%1-palette").arg(item->data(Qt::UserRole).toInt())).value<QPalette>();
    QFont font = settings.value(QString("log-level-%1-font").arg(item->data(Qt::UserRole).toInt())).value<QFont>();
    item->setBackground(palette.base());
    item->setForeground(palette.text());
    item->setFont(font);
    sourceModel->appendRow(item);
}
Пример #13
0
void SettingsDlg::slotBgCBChecked(bool value)
{
    if (value == false) {
        QPalette palette;
        m_UiWidgets.bgColorB->setColor( palette.base().color() );
        m_UiWidgets.bgColorB->setDisabled(true);
    }
    else {
        m_UiWidgets.bgColorB->setDisabled(false);
    }
}
Пример #14
0
// A ctor.
QsciStyle::QsciStyle(int style)
{
    init(style);

    QPalette pal = QApplication::palette();
    setColor(pal.text().color());
    setPaper(pal.base().color());

    setFont(QApplication::font());
    setEolFill(false);
}
Пример #15
0
ChannelView::ChannelView(QWidget *parent) : QListView(parent),
    showUpdated(false),
    sortBy(SortByName) {

    setItemDelegate(new ChannelItemDelegate(this));
    setSelectionMode(QAbstractItemView::NoSelection);

    // layout
    setSpacing(15);
    setFlow(QListView::LeftToRight);
    setWrapping(true);
    setResizeMode(QListView::Adjust);
    setMovement(QListView::Static);
    setUniformItemSizes(true);

    // cosmetics
    setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
    setFrameShape(QFrame::NoFrame);
    setAttribute(Qt::WA_MacShowFocusRect, false);

    QPalette p = palette();
    /*
    p.setColor(QPalette::Base, p.window().color());
    p.setColor(QPalette::Text, p.windowText().color());
    */
    p.setColor(QPalette::Disabled, QPalette::Base, p.base().color());
    p.setColor(QPalette::Disabled, QPalette::Text, p.text().color());
    setPalette(p);

    verticalScrollBar()->setPageStep(3);
    verticalScrollBar()->setSingleStep(1);

    setMouseTracking(true);

    connect(this, SIGNAL(clicked(const QModelIndex &)),
            SLOT(itemActivated(const QModelIndex &)));
    connect(this, SIGNAL(entered(const QModelIndex &)),
            SLOT(itemEntered(const QModelIndex &)));

    channelsModel = new ChannelModel(this);
    setModel(channelsModel);
    connect(this, SIGNAL(viewportEntered()),
            channelsModel, SLOT(clearHover()));

    setupActions();

    connect(ChannelAggregator::instance(), SIGNAL(channelChanged(YTChannel*)),
            channelsModel, SLOT(updateChannel(YTChannel*)));
    connect(ChannelAggregator::instance(), SIGNAL(unwatchedCountChanged(int)),
            SLOT(unwatchedCountChanged(int)));

    unwatchedCountChanged(ChannelAggregator::instance()->getUnwatchedCount());
}
Пример #16
0
void FormStyle::GlobalColorButtonCliked()
{
	QColor initialColor;
	if ( focusWidget()->objectName() == "bC1_1" )
		initialColor = applicationPalette.button().color().rgba();
	else if ( focusWidget()->objectName() == "bC1_2" )
		initialColor = applicationPalette.window().color().rgba();
	else if ( focusWidget()->objectName() == "bC1_3" )
		initialColor = applicationPalette.shadow().color().rgba();
	else if ( focusWidget()->objectName() == "bC1_4" )
		initialColor = applicationPalette.highlight().color().rgba();
	else if ( focusWidget()->objectName() == "bC1_5" )
		initialColor = applicationPalette.base().color().rgba();
	else if ( focusWidget()->objectName() == "bC1_6" )
		initialColor = applicationPalette.text().color().rgba();
	else if ( focusWidget()->objectName() == "bC1_7" )
		initialColor = applicationPalette.highlightedText().color().rgba();
	else if ( focusWidget()->objectName() == "bC1_8" )
		initialColor = sliderButtonColor.rgb();
	else
		initialColor = Qt::white;

	QColor color = QColorDialog::getColor( initialColor, this, Texts[ 119 ] /*Wybierz kolor*/, QColorDialog::DontUseNativeDialog );

	if ( !color.isValid() )
		return;

	if ( focusWidget()->objectName() == "bC1_1" )
		applicationPalette.setBrush( QPalette::Button, color );
	else if ( focusWidget()->objectName() == "bC1_2" )
		applicationPalette.setBrush( QPalette::Window, color );
	else if ( focusWidget()->objectName() == "bC1_3" )
	{
		applicationPalette.setBrush( QPalette::Shadow, color );
		applicationPalette.setBrush( QPalette::Light, color );
		applicationPalette.setBrush( QPalette::Dark, color );
	} else if ( focusWidget()->objectName() == "bC1_4" )
		applicationPalette.setBrush( QPalette::Highlight, color );
	else if ( focusWidget()->objectName() == "bC1_5" )
		applicationPalette.setBrush( QPalette::Base, color );
	else if ( focusWidget()->objectName() == "bC1_6" )
	{
		applicationPalette.setBrush( QPalette::Text, color );
		applicationPalette.setBrush( QPalette::WindowText, color );
		applicationPalette.setBrush( QPalette::ButtonText, color );
	} else if ( focusWidget()->objectName() == "bC1_7" )
		applicationPalette.setBrush( QPalette::HighlightedText, color );
	else if ( focusWidget()->objectName() == "bC1_8" )
		sliderButtonColor = color;

	setButtonsColor();
}
Пример #17
0
void ItemWidget::setHighlight(const QRegExp &re, const QFont &highlightFont,
                              const QPalette &highlightPalette)
{
    QPalette palette( widget()->palette() );
    palette.setColor(QPalette::Highlight, highlightPalette.base().color());
    palette.setColor(QPalette::HighlightedText, highlightPalette.text().color());
    widget()->setPalette(palette);

    if (m_re == re)
        return;
    m_re = re;
    highlight(re, highlightFont, highlightPalette);
}
Пример #18
0
/** Custom rendering. */
void SearchDialog::paintEvent(QPaintEvent *)
{
	QStylePainter p(this);
	QPalette palette = QApplication::palette();
	p.setPen(palette.mid().color());
	p.setBrush(palette.base());
	p.drawRect(rect().adjusted(0, 0, -1, -1));
	p.setPen(palette.midlight().color());
	p.drawLine(1, labelSearchMore->height() - 1, rect().width() - 2, labelSearchMore->height() - 1);
	int y = rect().y() + rect().height() - aggregated->height();
	p.drawLine(39, rect().y() + labelSearchMore->height(), 39, y);
	p.drawLine(1, y, rect().width() - 2, y);
}
Пример #19
0
/**
 * @brief Loads the default application settings.
 */
void Settings::load_default_application_settings() {

  QPalette palette;
  QString alternate_color = palette.alternateBase().color().name();
  QString base_color = palette.base().color().name();

  // Map editor.
  default_values[map_background] = alternate_color;

  // Sprite editor.
  default_values[sprite_main_background] = base_color;
  default_values[sprite_previewer_background] = base_color;
}
Пример #20
0
void QuickStart::paintEvent(QPaintEvent *)
{
	QPainter p(this);
	QPalette palette = QApplication::palette();
	p.fillRect(this->rect(), palette.base());
	p.setPen(palette.mid().color());
	if (isLeftToRight()) {
		p.drawLine(QPoint(rect().width() / 2 - 1, 0), rect().topRight());
		p.drawLine(rect().topRight(), rect().bottomRight());
	} else {
		p.drawLine(rect().topLeft(), QPoint(rect().width() / 2 - 1, 0));
		p.drawLine(rect().topLeft(), rect().bottomLeft());
	}
}
Пример #21
0
void SimplePartWidget::slotMarkupPlainText()
{
    // NOTICE "single shot", we get a recursion otherwise!
    disconnect(this, &QWebView::loadFinished, this, &SimplePartWidget::slotMarkupPlainText);

    // If there's no data, don't try to "fix it up"
    if (!m_partIndex.isValid() || !m_partIndex.data(Imap::Mailbox::RoleIsFetched).toBool())
        return;

    QPalette palette = QApplication::palette();

    // and finally set the marked up page.
    page()->mainFrame()->setHtml(UiUtils::htmlizedTextPart(m_partIndex, QFontDatabase::systemFont(QFontDatabase::FixedFont),
                                                           palette.base().color(), palette.text().color(),
                                                           palette.link().color(), palette.linkVisited().color()));
}
Пример #22
0
/*! \~russian
 * \brief Метод инициализирует элементы настройки цвета в соответствии с переданной палитрой.
 * \param palette - палитра для инициализации
 */
void Settings::initColorPickers(QPalette palette)
{
    ui->Frame_Style_Window->setColor( palette.window().color() );
    ui->Frame_Style_WindowText->setColor( palette.windowText().color() );
    ui->Frame_Style_Base->setColor( palette.base().color() );
    ui->Frame_Style_AlternateBase->setColor( palette.alternateBase().color() );
    ui->Frame_Style_ToolTipBase->setColor( palette.toolTipBase().color() );
    ui->Frame_Style_ToolTipText->setColor( palette.toolTipText().color() );
    ui->Frame_Style_Text->setColor( palette.text().color() );
    ui->Frame_Style_Button->setColor( palette.button().color() );
    ui->Frame_Style_ButtonText->setColor( palette.buttonText().color() );
    ui->Frame_Style_BrightText->setColor( palette.brightText().color() );
    ui->Frame_Style_Link->setColor( palette.link().color() );
    ui->Frame_Style_Highlight->setColor( palette.highlight().color() );
    ui->Frame_Style_HighlightedText->setColor( palette.highlightedText().color() );
}
Пример #23
0
void lmcUserTreeWidgetDelegate::drawCheckBox(QPainter *painter, const QPalette& palette,
										const QRect &checkBoxRect, Qt::CheckState checkState) const {
	painter->setPen(QPen(palette.color(QPalette::Shadow)));
	painter->setBrush(palette.base());
	painter->drawRect(checkBoxRect);

	if(checkState == Qt::Checked) {
		painter->setPen(QPen(palette.text(), 1));
		painter->drawLine(checkBoxRect.left() + 2, checkBoxRect.top() + 6, checkBoxRect.left() + 4, checkBoxRect.top() + 8);
		painter->drawLine(checkBoxRect.left() + 2, checkBoxRect.top() + 7, checkBoxRect.left() + 4, checkBoxRect.top() + 9);
		painter->drawLine(checkBoxRect.left() + 2, checkBoxRect.top() + 8, checkBoxRect.left() + 4, checkBoxRect.top() + 10);
		painter->drawLine(checkBoxRect.left() + 4, checkBoxRect.top() + 8, checkBoxRect.left() + 10, checkBoxRect.top() + 2);
		painter->drawLine(checkBoxRect.left() + 4, checkBoxRect.top() + 9, checkBoxRect.left() + 10, checkBoxRect.top() + 3);
		painter->drawLine(checkBoxRect.left() + 4, checkBoxRect.top() + 10, checkBoxRect.left() + 10, checkBoxRect.top() + 4);
	}
}
Пример #24
0
void VideoWindow::highlight(int ms)
{
    for(int r=0; r < this->eventsPositionInMiliseconds.size(); r++){
        QTableWidgetItem* item = this->ui->sequence->item(r,0);
        if(this->eventsPositionInMiliseconds.at(r) <= ms+125){
            if(this->eventsPositionInMiliseconds.at(r) >= ms-125)  item->setBackgroundColor(Qt::green);
            else item->setBackgroundColor(QColor(153,255,255));
        } else {
            QPalette p;
            if(r%2==0)
                item->setBackground(p.base());
            else
                item->setBackground(p.alternateBase());
        }
    }
}
Пример #25
0
void PreferenceDialog::saveAppearance(QSettings &settings)
{
    QFont font = ui->sampleEdit->font();
    QPalette palette = ui->sampleEdit->palette();
    settings.setValue(IniKey_BoxColorBg, palette.base().color());
    settings.setValue(IniKey_BoxColorFg, palette.text().color());
    settings.setValue(IniKey_BoxFont, font);

    settings.setValue(IniKey_ViewColorBgMark, m_colorMap["clrBgMark"]);
    settings.setValue(IniKey_ViewColorBgNormal, m_colorMap["clrBgNormal"]);
    settings.setValue(IniKey_ViewColorFgHidden, m_colorMap["clrFgHidden"]);
    settings.setValue(IniKey_ViewColorFgMark, m_colorMap["clrFgMark"]);
    settings.setValue(IniKey_ViewColorFgNormal, m_colorMap["clrFgNormal"]);
    settings.setValue(IniKey_ViewColorFgReadonly, m_colorMap["clrFgReadonly"]);
    settings.setValue(IniKey_ViewColorFgSystem, m_colorMap["clrFgSystem"]);
    settings.setValue(IniKey_ViewFont, m_model.font());
}
Пример #26
0
void FormStyle::setButtonsColor()
{
	if ( ui.ccB->isChecked() )
	{
		QPalette tmpPalette;

		tmpPalette.setBrush( QPalette::Button, applicationPalette.button() );
		ui.bC1_1->setPalette( tmpPalette );
		tmpPalette.setBrush( QPalette::Button, applicationPalette.window() );
		ui.bC1_2->setPalette( tmpPalette );
		tmpPalette.setBrush( QPalette::Button, applicationPalette.shadow() );
		ui.bC1_3->setPalette( tmpPalette );
		tmpPalette.setBrush( QPalette::Button, applicationPalette.highlight() );
		ui.bC1_4->setPalette( tmpPalette );
		tmpPalette.setBrush( QPalette::Button, applicationPalette.base() );
		ui.bC1_5->setPalette( tmpPalette );
		tmpPalette.setBrush( QPalette::Button, applicationPalette.text() );
		ui.bC1_6->setPalette( tmpPalette );
		tmpPalette.setBrush( QPalette::Button, applicationPalette.highlightedText() );
		ui.bC1_7->setPalette( tmpPalette );
		tmpPalette.setBrush( QPalette::Button, sliderButtonColor );
		ui.bC1_8->setPalette( tmpPalette );

		if ( !mainWindowPixmap.isNull() )
		{
			QBrush brushW( mainWindowPixmap.scaled( ui.bP2_2->size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation ) );
			tmpPalette.setBrush( QPalette::Button, brushW );
			ui.bP2_2->setPalette( tmpPalette );
		}
		else
			ui.bP2_2->setPalette( qApp->palette() );
	}
	else
	{
		ui.bC1_1->setPalette( qApp->palette() );
		ui.bC1_2->setPalette( qApp->palette() );
		ui.bC1_3->setPalette( qApp->palette() );
		ui.bC1_4->setPalette( qApp->palette() );
		ui.bC1_5->setPalette( qApp->palette() );
		ui.bC1_6->setPalette( qApp->palette() );
		ui.bC1_7->setPalette( qApp->palette() );
		ui.bC1_8->setPalette( qApp->palette() );

		ui.bP2_2->setPalette( qApp->palette() );
	}
}
Пример #27
0
void StartMainPage::applyPalette(const QPalette& newPalette)
{
    QColor fgColor = newPalette.text().color();

    QPalette pal = palette();
    pal.setBrush(backgroundRole(), newPalette.base());
    pal.setBrush(QPalette::Button, newPalette.base());
    pal.setBrush(QPalette::WindowText, fgColor);
    pal.setBrush(QPalette::ButtonText, fgColor);
    pal.setBrush(QPalette::Text, fgColor);
    setPalette(pal);

    initViewPalette(d->mBookmarksView, fgColor);
    initViewPalette(d->mTagView, fgColor);
    initViewPalette(d->mRecentFoldersView, fgColor);
    initViewPalette(d->mRecentUrlsView, fgColor);
}
Пример #28
0
void KWidgetListbox::setItemColors(int index, bool even)
{
  QWidget* itm = item(index);
  // KDE4 add
  QPalette p = palette();
if ( !itm){ kDebug()<<"no widget at index "<<index; return; }
/*
  if(index == selected())
  {
    itm->setPaletteBackgroundColor(KGlobalSettings::highlightColor());
    itm->setPaletteForegroundColor(KGlobalSettings::highlightedTextColor());
  }*/
  if(even)
   p.setColor(backgroundRole(), p.base().color() );
  else
   p.setColor(backgroundRole(), p.alternateBase().color() );
  
  p.setColor(foregroundRole(), p.text().color() );
  itm->setPalette(p); 
}
Пример #29
0
void ItemText::highlight(const QRegExp &re, const QFont &highlightFont, const QPalette &highlightPalette)
{
    m_searchTextDocument.clear();
    if ( re.isEmpty() ) {
        setDocument(&m_textDocument);
    } else {
        bool plain = m_textFormat == Qt::PlainText;
        const QString &text = plain ? m_textDocument.toPlainText() : m_textDocument.toHtml();
        if (plain)
            m_searchTextDocument.setPlainText(text);
        else
            m_searchTextDocument.setHtml(text);

        QTextCursor cur = m_searchTextDocument.find(re);
        int a = cur.position();
        while ( !cur.isNull() ) {
            QTextCharFormat fmt = cur.charFormat();
            if ( cur.hasSelection() ) {
                fmt.setBackground( highlightPalette.base() );
                fmt.setForeground( highlightPalette.text() );
                fmt.setFont(highlightFont);
                cur.setCharFormat(fmt);
            } else {
                cur.movePosition(QTextCursor::NextCharacter);
            }
            cur = m_searchTextDocument.find(re, cur);
            int b = cur.position();
            if (a == b) {
                cur.movePosition(QTextCursor::NextCharacter);
                cur = m_searchTextDocument.find(re, cur);
                b = cur.position();
                if (a == b) break;
            }
            a = b;
        }
        setDocument(&m_searchTextDocument);
    }

    update();
}
Пример #30
0
QVariantMap Bridge::get_palette()
{
    QVariantMap colors;
    QPalette palette = qApp->palette();
    colors.insert("window", palette.window().color().name());
    colors.insert("window_text", palette.windowText().color().name());
    colors.insert("base", palette.base().color().name());
    colors.insert("alternate_base", palette.alternateBase().color().name());
    colors.insert("text", palette.text().color().name());
    colors.insert("button", palette.buttonText().color().name());
    colors.insert("bright_text", palette.brightText().color().name());
    colors.insert("light", palette.light().color().name());
    colors.insert("midlight", palette.midlight().color().name());
    colors.insert("dark", palette.dark().color().name());
    colors.insert("mid", palette.mid().color().name());
    colors.insert("shadow", palette.shadow().color().name());
    colors.insert("highlight", palette.highlight().color().name());
    colors.insert("highlight_text", palette.highlightedText().color().name());
    colors.insert("link", palette.link().color().name());
    colors.insert("link_visited", palette.linkVisited().color().name());
    return colors;
}