void FadeCmd::AutoSizeFont() { QFont fnt("Monospace"); fnt.setStyleHint(QFont::TypeWriter); fnt.setPixelSize( qMax(10,qRound(height()*0.6)) ); setFont(fnt); }
void DropGrid::Paint(Draw& w) { Size sz = GetSize(); Size isz = clear.GetStdSize(); if(clear_button && !notnull && IsEnabled() && IsSelected()) { clear.Show(); clear.RightPos(3, isz.cx).TopPos((sz.cy - isz.cy) / 2, isz.cy); } else clear.Hide(); GridDisplay &disp = display ? *display : list.GetDisplay(); bool hf = HasFocus(); bool isnull = rowid < 0; Color fg = hf ? SColorHighlightText() : IsEnabled() ? SColorText() : SColorDisabled(); Color bg = !IsEnabled() || !IsEditable() ? EditField::StyleDefault().disabled : notnull && isnull ? Blend(SColorPaper, Color(255, 0, 0), 32) : hf ? SColorHighlight() : SColorPaper(); const int d = 0; if(isnull) w.DrawRect(d, d, sz.cx - d * 2, sz.cy - d * 2, bg); else { Font fnt(StdFont()); Paint0(w, 1, 1, d, d, sz.cx - d * 2, sz.cy - d * 2, Format0(Null, rowid), 0, fg, bg, fnt); } if(hf) DrawFocus(w, d - 0, d - 0, sz.cx - (d - 0) * 2, sz.cy - (d - 0) * 2); }
CDialogAbout::CDialogAbout(wxWindow *parent) : wxDialog(parent,wxID_ANY, _T("About OSIRIS " OSIRIS_VERSION "..."), wxDefaultPosition, wxDefaultSize, // wxDEFAULT_DIALOG_STYLE) mainApp::DIALOG_STYLE) { wxBoxSizer *pSizer(new wxBoxSizer(wxHORIZONTAL)); wxBoxSizer *pSizerRight(new wxBoxSizer(wxVERTICAL)); wxTextCtrl *pReadMe(new wxTextCtrl(this,wxID_ANY, g_sReadMe,wxDefaultPosition,wxSize(200,-1), wxTE_READONLY | wxTE_MULTILINE | wxTE_WORDWRAP)); nwxColorUtil::BackgroundParent(pReadMe,true); wxFont fnt(pReadMe->GetFont()); fnt.SetPointSize(10); pReadMe->SetFont(fnt); //pReadMe->SetBackgroundColour(*wxWHITE); pSizerRight->Add(pReadMe,1,wxEXPAND | wxALL, ID_BORDER); pSizerRight->Add(CreateButtonSizer(wxOK),0,wxBOTTOM | wxALIGN_CENTER,ID_BORDER); pSizer->Add(new CPanelAbout(this),0,wxEXPAND); pSizer->Add(pSizerRight,1,wxEXPAND); SetSizer(pSizer); Layout(); Fit(); Centre(); }
void TagColorEditor::setColors() { QFont fnt("Helvetica", 12); uchar *colors = Global::tagColors(); for (int i=0; i < 256; i++) { int row = i/2; int col = i%2; int r,g,b; float a; r = colors[4*i+0]; g = colors[4*i+1]; b = colors[4*i+2]; QTableWidgetItem *colorItem = table->item(row, col); if (!colorItem) { colorItem = new QTableWidgetItem; table->setItem(row, col, colorItem); } colorItem->setFont(fnt); colorItem->setData(Qt::DisplayRole, QString("%1").arg(i)); if (colors[4*i+3] > 250) colorItem->setCheckState(Qt::Checked); else colorItem->setCheckState(Qt::Unchecked); colorItem->setBackground(QColor(r,g,b)); } }
void DBoxFE_Splash::drawContents( QPainter* painter ) { int position; QColor base_color( 255, 255, 255 ); painter->setPen( Qt::NoPen ); painter->setBrush( QColor( 255, 255, 255 ) ); painter->drawEllipse( 51, 7, 9, 9 ); painter->drawEllipse( 62, 7, 9, 9 ); painter->drawEllipse( 73, 7, 9, 9 ); for ( int i = 0; i < progress_bar_size; i++ ) { position = ( state + i ) % ( 2 * progress_bar_size - 1 ); painter->setBrush( QColor( base_color.red() - 18 * i, base_color.green() - 10 * i, base_color.blue() - 28 * i ) ); if ( position < 3 ) painter->drawEllipse( 51 + position * 11, 7, 9, 9 ); } painter->setPen( QColor( 255, 255, 255 ) ); QFont fnt( "Verdena" ); fnt.setPointSize( 12 ); painter->setFont( fnt ); if ( m_string.length() > 40 ) { m_string.truncate( 39 ); m_string += "..."; } painter->drawText( 90, 16, m_string ); }
// No hardcoding test!!! void SidarTestPaint1::sidarPaint(const SidarLabel &pSidar) { QPen penline(QColor(70, 255, 0)); QPen pentext(QColor(0, 167, 255)); QSize Sidar_size = pSidar.size(); QPainter pnt((QPaintDevice*)&pSidar); pnt.setPen(penline); QString s("WRAPPED"); QFont fnt(pSidar.font()); QFontMetrics fm(fnt); int pixW = fm.width(s); int pixH = fm.height(); // unused for now pnt.save(); int texBegin = (Sidar_size.width()/2) - pixW/2; int texEnd = (Sidar_size.width()/2) + pixW/2; int drawHeight = Sidar_size.height()/2; pnt.drawLine(QLine(0, drawHeight, texBegin, drawHeight)); pnt.setPen(pentext); pnt.drawText(texBegin, drawHeight+(pixH/3), s); pnt.setPen(penline); pnt.drawLine(QLine(texEnd, drawHeight, Sidar_size.width(), drawHeight)); pnt.restore(); }
// Subclass QProgressDialog() MyQProgressDialog::MyQProgressDialog(LPCSTR titleText, LPCSTR labelText, LPCSTR styleSheet, LPCSTR icon) : QProgressDialog(labelText, CANCEL, 0, 100, QApplication::activeWindow(), 0), m_isCanceled(FALSE), m_indeterminateMode(FALSE), m_lastProgress(-1), m_hMouseHook(NULL), m_hWinHook(NULL), m_hTimerQueue(NULL), m_hUpdateTimer(NULL) { setWindowTitle(titleText); setAutoReset(FALSE); setAutoClose(FALSE); setWindowModality(Qt::WindowModal); setFixedSize(DAILOG_WIDTH, DAILOG_HEIGHT); setSizeGripEnabled(FALSE); // Qt::Tool -- Smaller title bar with smaller 'X' // Qt::Popup -- Boarderless // Qt::SubWindow -- Nonmodal on top with no background //setWindowFlags(Qt::Tool); // Nix the title bar help button setWindowFlags((windowFlags() & ~Qt::WindowContextHelpButtonHint) | Qt::WindowMinimizeButtonHint); // This time must elapse before dialog shows (default 4sec) setMinimumDuration(SHOW_DELAY); // Set dialog font (and children inherit) QFont fnt(FONT, 10, QFont::Normal); fnt.setStyleStrategy(QFont::PreferAntialias); setFont(fnt); // Put the progress text in the middle if (QProgressBar *bar = findChild<QProgressBar *>()) bar->setAlignment(Qt::AlignCenter); // Optionally set Qt style sheet if (styleSheet && styleSheet[0]) { // From a file? if (strncmp(styleSheet, "url(", 4) == 0) { QString fn(styleSheet + (sizeof("url(") - 1)); fn.chop(1); QFile f(fn); if (f.open(QFile::ReadOnly | QFile::Text)) setStyleSheet(QTextStream(&f).readAll()); } else // No, string setStyleSheet(styleSheet); } // Optionally set titlebar icon if (icon && icon[0]) setWindowIcon(QIcon(icon)); // Progress 0 for the control to setup internally setValue(0); // Start update interval timer if (m_hTimerQueue = CreateTimerQueue()) CreateTimerQueueTimer(&m_hUpdateTimer, m_hTimerQueue, (WAITORTIMERCALLBACK)timerTick, NULL, TARGET_UPDATE_MS, TARGET_UPDATE_MS, 0); _ASSERT(m_hUpdateTimer != NULL); }
void MessageOverlay::paintEvent(QPaintEvent *) { QPainter p(this); QRect r(rect()); QRectF rf(r.x()+0.5, r.y()+0.5, r.width()-1, r.height()-1); QColor borderCol=palette().color(QPalette::Highlight).darker(120); QColor col=palette().color(QPalette::Window); QPainterPath path=Utils::buildPath(rf, r.height()/4.0); col.setAlphaF(0.8); p.setRenderHint(QPainter::Antialiasing, true); p.fillPath(path, col); p.setPen(QPen(borderCol, qMax(2, r.height()/16))); p.drawPath(path); int pad=r.height()/4; if (cancelButton->isVisible()) { if (Qt::LeftToRight==layoutDirection() && !closeOnLeft) { rf.adjust(pad, pad, -((pad*2)+cancelButton->width()), -pad); } else { rf.adjust(((pad*2)+cancelButton->width()), pad, -pad, -pad); } } else { rf.adjust(pad, pad, -pad, -pad); } QFont fnt(QApplication::font()); fnt.setBold(true); QFontMetrics fm(fnt); col=palette().color(QPalette::WindowText); p.setPen(col); p.setFont(fnt); p.drawText(rf, fm.elidedText(text, Qt::ElideRight, r.width(), QPalette::WindowText), QTextOption(Qt::LeftToRight==layoutDirection() ? Qt::AlignLeft : Qt::AlignRight)); p.end(); }
QGraphicsItemGroup *ProfileGraphicsView::plot_text(text_render_options_t *tro,const QPointF& pos, const QString& text, QGraphicsItem *parent) { QFont fnt(font()); QFontMetrics fm(fnt); if (printMode) fnt.setPixelSize(tro->size); QPointF point(SCALEGC(pos.x(), pos.y())); // This is neded because of the SCALE macro. double dx = tro->hpos * (fm.width(text)); double dy = tro->vpos * (fm.height()); QGraphicsItemGroup *group = new QGraphicsItemGroup(parent); QPainterPath textPath; /* addText() uses bottom-left text baseline and the -3 offset is probably slightly off * for different font sizes. */ textPath.addText(0, fm.height() - 3, fnt, text); QPainterPathStroker stroker; stroker.setWidth(3); QGraphicsPathItem *strokedItem = new QGraphicsPathItem(stroker.createStroke(textPath), group); strokedItem->setBrush(QBrush(getColor(TEXT_BACKGROUND))); strokedItem->setPen(Qt::NoPen); QGraphicsPathItem *textItem = new QGraphicsPathItem(textPath, group); textItem->setBrush(QBrush(getColor(tro->color))); textItem->setPen(Qt::NoPen); group->setPos(point.x() + dx, point.y() + dy); if (!printMode) group->setFlag(QGraphicsItem::ItemIgnoresTransformations); if (!parent) scene()->addItem(group); return group; }
void ItemViewImageDelegate::drawImageFormat(QPainter* p, const QRect& r, const QString& f) const { Q_D(const ItemViewImageDelegate); if (!f.isEmpty() && !r.isNull()) { p->save(); QFont fnt(d->fontReg); fnt.setWeight(QFont::Black); fnt.setItalic(false); p->setFont(fnt); p->setPen(QPen(Qt::gray)); p->setOpacity(0.50); QRect bRect = p->boundingRect(r, Qt::AlignBottom | Qt::AlignHCenter, f.toUpper()); bRect.adjust(1, 1, -1, -1); bRect.translate(0, 1); p->fillRect(bRect, Qt::SolidPattern); p->setPen(QPen(Qt::white)); p->setOpacity(1.0); p->drawText(bRect, Qt::AlignBottom | Qt::AlignHCenter, f.toUpper()); p->restore(); } }
void FadeMetro::AutoSizeFont() { QFont fnt( font() ); int d = qMin(width(), qMax(m_TextMargin,m_LabelMargin)); fnt.setPixelSize( qMax(10,qRound(d*0.7)) ); setFont(fnt); }
Connecting::Connecting(QWidget *parent) : QWidget(parent), m_client(NULL), m_task(NULL), state(0), tries(0) { ui.setupUi(this); connect(&m_timer, SIGNAL(timeout()), this, SLOT(proceed())); connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(abort())); QMovie* movie = new QMovie(":/preloader/cube"); // Make sure the GIF was loaded correctly if (!movie->isValid()) { // Something went wrong :( ui.preloader->setText("Loading"); } else { // Play GIF ui.preloader->setMovie(movie); movie->start(); } m_try_limit = 6; QFont fnt(ui.btnCancel->font()); fnt.setFamily("Ubuntu Light"); fnt.setPointSize(16); ui.btnCancel->setFont(fnt); }
void SidarTestPaint::sidarPaint(const SidarLabel &pSidar) { QPen penline(QColor(255, 0, 0)); QPen pentext(QColor(0, 0, 255)); QPainter pnt((QPaintDevice*)&pSidar); pnt.setPen(penline); QString s1("Left"); QString s2("Right"); QFont fnt(pSidar.font()); QFontMetrics fm(fnt); int pixW1 = fm.width(s1); int pixH1 = fm.height(); int pixW2 = fm.width(s2); pnt.save(); pnt.setPen(pentext); pnt.drawText(0, pixW1, s1); pnt.setPen(penline); /*pixW1+pSidar.size().width()-pixW2,*/ pnt.drawLine(QLine(pixW1, pixW1, pSidar.size().width()-pixW2, pixW1)); pnt.setPen(pentext); pnt.drawText(pSidar.size().width()-pixW2, pixW1, s2); pnt.restore(); }
void K3b::DataMultisessionImportDialog::addMedium( const K3b::Medium& medium ) { QTreeWidgetItem* mediumItem = new QTreeWidgetItem( d->sessionView ); QFont fnt( mediumItem->font(0) ); fnt.setBold( true ); mediumItem->setText( 0, medium.shortString() ); mediumItem->setFont( 0, fnt ); mediumItem->setIcon( 0, QIcon::fromTheme("media-optical-recordable") ); const K3b::Device::Toc& toc = medium.toc(); QTreeWidgetItem* sessionItem = 0; int lastSession = 0; for ( K3b::Device::Toc::const_iterator it = toc.begin(); it != toc.end(); ++it ) { const K3b::Device::Track& track = *it; if( track.session() != lastSession ) { lastSession = track.session(); QString sessionInfo; if ( track.type() == K3b::Device::Track::TYPE_DATA ) { K3b::Iso9660 iso( medium.device(), track.firstSector().lba() ); if ( iso.open() ) { sessionInfo = iso.primaryDescriptor().volumeId; } } else { int numAudioTracks = 1; while ( it != toc.end() && ( *it ).type() == K3b::Device::Track::TYPE_AUDIO && ( *it ).session() == lastSession ) { ++it; ++numAudioTracks; } --it; sessionInfo = i18np("1 audio track", "%1 audio tracks", numAudioTracks ); } sessionItem = new QTreeWidgetItem( mediumItem, sessionItem ); sessionItem->setText( 0, i18n( "Session %1", lastSession ) + ( sessionInfo.isEmpty() ? QString() : " (" + sessionInfo + ')' ) ); if ( track.type() == K3b::Device::Track::TYPE_AUDIO ) sessionItem->setIcon( 0, QIcon::fromTheme( "audio-x-generic" ) ); else sessionItem->setIcon( 0, QIcon::fromTheme( "application-x-tar" ) ); d->sessions.insert( sessionItem, SessionInfo( lastSession, medium.device() ) ); } } if( 0 == lastSession ) { // the medium item in case we have no session info (will always use the last session) d->sessions.insert( mediumItem, SessionInfo( 0, medium.device() ) ); } else { // we have a session item, there is no need to select the medium as a whole mediumItem->setFlags( mediumItem->flags() ^ Qt::ItemIsSelectable ); } mediumItem->setExpanded( true ); }
void Tab::init() { setMinimumHeight(50); QFont fnt(font()); fnt.setStyleName("Normal"); setFont(fnt); }
//============================================================================================== /*virtual*/ void TightFontDisplayForArrayCtrl::Paint(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword style) const { Font fnt(FontZ(Font::COURIER, 9)); String txt = q; w.DrawRect(r, paper); w.DrawText(r.left + 2, r.top + (r.Height() - GetTextSize(txt, fnt).cy) / 2, txt, fnt, ink); // <- Change is here - "w." no more needed }
void FileItem::setBold(bool b) { if (font(0).bold() == b) return; QFont fnt(font(0)); fnt.setBold(b); setFont(0, fnt); }
JailbreakMainWindow::JailbreakMainWindow(void) : wxFrame(NULL, wxID_ANY, wxT(WND_TITLE), wxDefaultPosition, wxSize(WND_WIDTH, WND_HEIGHT), (wxDEFAULT_FRAME_STYLE) & ~(wxRESIZE_BORDER | wxMAXIMIZE_BOX)) { wxPanel* panel = new wxPanel(this, wxID_ANY, wxPoint(0, 0), wxSize(WND_WIDTH, WND_HEIGHT)); wxBoxSizer *vbox = new wxBoxSizer(wxVERTICAL); #if defined(__WXGTK__) #define FNTSIZE 10 #endif #if defined(__WXOSX_COCOA__) || defined(__WXMAC__) #define FNTSIZE 12 #endif #if defined(__WXMSW__) #define FNTSIZE 9 #endif wxFont fnt(FNTSIZE, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL); wxStaticText* lbTop = new wxStaticText(panel, wxID_ANY, wxT("Welcome to p0sixspwn, an iOS 6.1.3-6.1.5 userland jailbreaking\nprogram. Make a backup of your device before proceeding.\n"), wxDefaultPosition, wxDefaultSize, wxST_NO_AUTORESIZE | wxALIGN_LEFT); lbTop->SetFont(fnt); lbTop->Wrap(WND_WIDTH-20); lbStatus = new wxStaticText(panel, wxID_ANY, wxT(""), wxDefaultPosition, wxDefaultSize, wxST_NO_AUTORESIZE); lbStatus->SetFont(fnt); #if defined (__WXMAC__) progressBar = new wxGauge(panel, wxID_ANY, 100, wxDefaultPosition, wxSize(300,11), wxGA_HORIZONTAL | wxGA_SMOOTH); #else progressBar = new wxGauge(panel, wxID_ANY, 100, wxDefaultPosition, wxSize(300,17), wxGA_HORIZONTAL | wxGA_SMOOTH); #endif btnStart = new wxButton(panel, 1111, wxT("Jailbreak")); btnStart->Enable(0); Connect(1111, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(JailbreakMainWindow::handleStartClicked)); wxBoxSizer* hbox = new wxBoxSizer(wxHORIZONTAL); hbox->Add(progressBar, 0, wxALIGN_CENTER_VERTICAL | wxALL, 10); hbox->Add(btnStart, 0, wxALIGN_CENTER_VERTICAL | wxALL, 10); wxStaticText* lbCredits = new wxStaticText(panel, wxID_ANY, wxT("greetz to: @winocm, @iH8sn0w, @SquiffyPwn, @planetbeing, @pimskeks\n"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER | wxST_NO_AUTORESIZE); lbCredits->SetFont(fnt); wxBoxSizer* hbox2 = new wxBoxSizer(wxHORIZONTAL); vbox->Add(lbTop, 0, wxEXPAND | wxALL, 10); vbox->Add(lbStatus, 1, wxEXPAND | wxALL, 10); vbox->Add(hbox, 0, wxCENTER | wxALL, 4); vbox->Add(lbCredits, 0, wxCENTER | wxALL, 10); vbox->Add(hbox2, 0, wxCENTER | wxALL, 4); panel->SetSizer(vbox); Centre(); this->worker = new JailbreakWorker((JailbreakMainWindow*)this); this->closeBlocked = 0; this->Connect(wxEVT_CLOSE_WINDOW, wxCloseEventHandler(JailbreakMainWindow::OnClose)); }
int CXTPRibbonGroup::GetMinimumWidth(CDC* pDC) { CXTPFontDC fnt(pDC, &GetRibbonBar()->GetRibbonPaintManager()->m_fontGroupCaption); CSize sz = pDC->GetTextExtent(m_strCaption); if (m_bShowOptionButton) sz.cx += GetRibbonBar()->GetRibbonPaintManager()->GetGroupCaptionHeight(); return sz.cx; }
void FlightItem::resizeEvent(QResizeEvent *event) { QWidget::resizeEvent(event); QWidget *view = parentWidget() ? parentWidget()->parentWidget() : 0; m_landscape = view && (view->width() > view->height()); const int i = (m_landscape ? 1 : 0); setFixedHeight(pixelSizes[i][1] + m_margin); QFont fnt(font()); fnt.setPixelSize(pixelSizes[i][0]); setFont(fnt); }
void TextEdit::setPalette(const PythonPalette& p) { QFont fnt(p.mainFont, p.mainFontPointSize); setFont(fnt); auto w = p.tabWidth * fontMetrics().width(' '); setTabStopWidth(w); if (m_Highlighter) m_Highlighter->setPalette(p); }
void OutputPreferences::writeSettings() { Settings s("ide/output"); QFont fnt(ui_->fontSelect->currentFont()); fnt.setPointSize(ui_->sizeSpin->value()); s.setValue("font", fnt); s.setValue("useEditorFont", ui_->editorBox->isChecked()); s.setValue("useSystemColors", ui_->syscolBox->isChecked()); s.setValue("foreground", ui_->foreButton->currentColor()); s.setValue("background", ui_->backButton->currentColor()); }
int WidgetContact::lineMargin() const { if ( m_cachedLineMargin == 0 ) { QFont fnt( font() ); fnt.setItalic( true ); const QFontMetrics fm( fnt ); m_cachedLineMargin = qMax( fm.width( whoStr() ), fm.width( whereStr() ) ); m_cachedLineMargin += MARGIN + 3; } return m_cachedLineMargin; }
void ListingClients::fillListingClients() { ui->listWidget->clear(); DbConnection connection("listing_clients"); QSqlQuery query; query.exec("SELECT NAME, ID FROM clients"); while(query.next()) { QListWidgetItem* qwi = new QListWidgetItem(QIcon(":profile.png"), query.value(0).toString()); QVariant var(query.value(1).toInt()); qwi->setData(Qt::UserRole, var); QFont fnt("Times New Roman", 14); qwi->setFont(fnt); ui->listWidget->addItem(qwi); } }
std::shared_ptr<sf::Font> ResourceManager::getFont(const std::string &key){ std::map<std::string, std::weak_ptr<sf::Font> >::iterator iter; iter = mFontMap.find(key); if( iter != mFontMap.end() && !iter->second.expired() ){ return iter->second.lock(); } else{ std::shared_ptr<sf::Font> fnt (new sf::Font); if (!fnt->loadFromFile(mFilePath + key)){ assert(false); } mFontMap.insert(std::pair<std::string, std::weak_ptr<sf::Font> >(key, fnt) ); return fnt; } }
void DiveTextItem::updateText() { double size; delete textItem; textItem = NULL; delete textBackgroundItem; textBackgroundItem = NULL; if (internalText.isEmpty()) { return; } QFont fnt(qApp->font()); if ((size = fnt.pixelSize()) > 0) { // set in pixels - so the scale factor may not make a difference if it's too close to 1 size *= scale; fnt.setPixelSize(size); } else { size = fnt.pointSizeF(); size *= scale; fnt.setPointSizeF(size); } QFontMetrics fm(fnt); QPainterPath textPath; qreal xPos = 0, yPos = 0; QRectF rect = fm.boundingRect(internalText); yPos = (internalAlignFlags & Qt::AlignTop) ? 0 : (internalAlignFlags & Qt::AlignBottom) ? +rect.height() : /*(internalAlignFlags & Qt::AlignVCenter ? */ +rect.height() / 4; xPos = (internalAlignFlags & Qt::AlignLeft) ? -rect.width() : (internalAlignFlags & Qt::AlignHCenter) ? -rect.width() / 2 : /* (internalAlignFlags & Qt::AlignRight) */ 0; textPath.addText(xPos, yPos, fnt, internalText); QPainterPathStroker stroker; stroker.setWidth(3); textBackgroundItem = new QGraphicsPathItem(stroker.createStroke(textPath), this); textBackgroundItem->setBrush(QBrush(getColor(TEXT_BACKGROUND))); textBackgroundItem->setPen(Qt::NoPen); textItem = new QGraphicsPathItem(textPath, this); textItem->setBrush(brush); textItem->setPen(Qt::NoPen); }
ClickLabel::ClickLabel(QWidget *parent) :QLabel(parent) { QFont fnt( font() ); fnt.setBold(true); setFont( fnt ); setFrameShape( QLabel::Panel ); setFrameShadow( QLabel::Sunken ); setAlignment( Qt::AlignCenter ); setToolTip( tr("Double click for details") ); setAutoFillBackground(true); QPalette pal = palette(); QColor col = QColor(0xff, 0xff, 0xff); pal.setColor(QPalette::Normal, QPalette::Window, col ); pal.setColor(QPalette::Inactive, QPalette::Window, col ); setPalette( pal ); }
bool stash::add_font( const std::vector<unsigned char> &data, const std::string &alias ) { if( !tex ) { // Create texture for the cache. glGenTextures(1, &tex); if( !tex ) return false; glBindTexture(GL_TEXTURE_2D, tex); glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, tw,th, 0, GL_ALPHA, GL_UNSIGNED_BYTE, 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); } sth_font fnt(tex, &rows, tw, th); // Init stb_truetype if( data.size() && stbtt_InitFont(&fnt.font, &data[0], 0) ) { // Read in the font data. fnt.data = data; // Store normalized line height. The real line height is got // by multiplying the lineh by font size. int ascent, descent, lineGap; stbtt_GetFontVMetrics(&fnt.font, &ascent, &descent, &lineGap); int fh = ascent - descent; fnt.ascender = (float)ascent / (float)fh; fnt.descender = (float)descent / (float)fh; fnt.lineh = (float)(fh + lineGap) / (float)fh; fonts.push_back( fnt ); aliases[ alias ] = fonts.size() - 1; // refresh data pointers because of std::vector reordering for( size_t i = 0; i < fonts.size(); ++i ) fonts[i].font.data = &fonts[i].data[0]; return true; } return false; }
void ListringAuthors::fillListingAuthors() { this->setWindowTitle("Авторы"); ui->createAuthor->setToolTip("Добавить автора"); ui->deleteAuthor->setToolTip("Удалить автора"); ui->searchLine->setToolTip("Введите Ф.И.О автора для поиска"); ui->label_2->setText("Список авторов:"); DbConnection* connection = new DbConnection(); QSqlQuery query; query.exec("SELECT NAME, ID FROM authors"); while(query.next()) { QListWidgetItem* qwi = new QListWidgetItem(QIcon(":author.png"), query.value(0).toString()); QVariant var(query.value(1).toInt()); qwi->setData(Qt::UserRole, var); QFont fnt("Times New Roman", 14); qwi->setFont(fnt); ui->listWidget->addItem(qwi); } }
void KDevSplashScreen::drawContents (QPainter* painter) { int position; QColor base_color (201,229,165); // Base green color // Draw background circles painter->setPen(NoPen); painter->setBrush(QColor(215,234,181)); painter->drawEllipse(51,7,9,9); painter->drawEllipse(62,7,9,9); painter->drawEllipse(73,7,9,9); // Draw animated circles, increments are chosen // to get close to background's color // (didn't work well with QColor::light function) for (int i=0; i < progress_bar_size; i++) { position = (state+i)%(2*progress_bar_size-1); painter->setBrush(QColor(base_color.red()-18*i, base_color.green()-10*i, base_color.blue()-28*i)); if (position < 3) painter->drawEllipse(51+position*11,7,9,9); } painter->setPen(QColor(74,112,18)); QFont fnt(KGlobalSettings::generalFont()); fnt.setPointSize(8); painter->setFont(fnt); // Draw version number QRect r = rect(); r.setRect(r.x() + 5, r.y() + 5, r.width() - 10, r.height() - 10); painter->drawText(r, Qt::AlignRight, i18n("Version %1").arg( VERSION )); // Draw message at given position, limited to 43 chars // If message is too long, string is truncated if (m_string.length() > 40) {m_string.truncate(39); m_string += "...";} painter->drawText (90, 16, m_string, 42); }