RankingLabel::RankingLabel(int w,int h,int picLen,QString iconPath, QString title, QString type, QString price, QWidget *parent) { main_layout = new QHBoxLayout(); main_layout->setContentsMargins(0, 0, 0, 0); main_layout->setMargin(0); QPalette palette; palette.setBrush(QPalette::WindowText, QBrush(Qt::white)); //this->setPalette(palette); //this->setAutoFillBackground(true); m_icon = new QLabel(); m_title = new QLabel(); m_type = new QLabel(); m_price = new QLabel(); int min_len = w > h ? h : w; this->setMinimumSize(w, h); QPixmap pixmap(iconPath); QPixmap transformed_pxmap = pixmap.scaled(picLen, h , Qt::IgnoreAspectRatio,Qt::SmoothTransformation); m_icon->setPixmap(transformed_pxmap); auto font = ProfileInstance().AppFont; font.setPixelSize(20); setColor(QColor(24, 116, 205)); m_title->setText(title); m_title->setFont(font); m_title->setPalette(palette); //m_title->setGraphicsEffect(Profile::generateGlowEffect(QColor(255,255,255), 5)); m_type->setText(type); m_type->setFont(ProfileInstance().AppFont); m_type->setPalette(palette); m_price->setText(price); m_price->setFont(ProfileInstance().AppFont); m_price->setPalette(palette); main_layout->addWidget(m_icon); QVBoxLayout *mid_layout = new QVBoxLayout(); mid_layout->addWidget(m_title); mid_layout->addWidget(m_type); main_layout->addLayout(mid_layout); main_layout->addStretch(); main_layout->addWidget(m_price,0,Qt::AlignCenter); main_layout->addStretch(); setLayout(main_layout); m_MouseOver = false; m_MousePress = false; this->update(); }
//----------------------------------------------------------------------- void Profiler::beginProfile(const String& profileName, uint32 groupID) { // regardless of whether or not we are enabled, we need the application's root profile (ie the first profile started each frame) // we need this so bogus profiles don't show up when users enable profiling mid frame // so we check // if the profiler is enabled if (!mEnabled) return; // mask groups if ((groupID & mProfileMask) == 0) return; // we only process this profile if isn't disabled if (mDisabledProfiles.find(profileName) != mDisabledProfiles.end()) return; // empty string is reserved for the root // not really fatal anymore, however one shouldn't name one's profile as an empty string anyway. assert ((profileName != "") && ("Profile name can't be an empty string")); // this would be an internal error. assert (mCurrent); // need a timer to profile! assert (mTimer && "Timer not set!"); ProfileInstance*& instance = mCurrent->children[profileName]; if(instance) { // found existing child. // Sanity check. assert(instance->name == profileName); if(instance->frameNumber != mCurrentFrame) { // new frame, reset stats instance->frame.calls = 0; instance->frame.frameTime = 0; instance->frameNumber = mCurrentFrame; } } else { // new child! instance = OGRE_NEW ProfileInstance(); instance->name = profileName; instance->parent = mCurrent; instance->hierarchicalLvl = mCurrent->hierarchicalLvl + 1; } instance->frameNumber = mCurrentFrame; mCurrent = instance; // we do this at the very end of the function to get the most // accurate timing results mCurrent->currTime = mTimer->getMicroseconds(); }
ToolButton* LauncherWidget::addToolButton(int w, int h, Webbox::Data::LaunchProperty *_p) // QString iconPath, QString buttonText) { QFont font = ProfileInstance().AppFont; font.setPointSize(11); //QPixmap p; //p.loadFromData(_p->getIcon()); ToolButton *btn = new ToolButton(w, h, QPixmap(Webbox::Config::AllCfg::getIconPath()+"/"+_p->icon_name)); btn->setText(_p->name_cn); btn->setFont(font); return btn; }
void CLabel::createLayout() { QPalette palette; palette.setBrush(QPalette::Window, QBrush(Qt::transparent)); this->setPalette(palette); m_pLabelText->setGraphicsEffect(ProfileInstance().generateGlowEffect(Qt::white, 5)); m_pHLayout = new QHBoxLayout; //m_pHLayout->setSpacing(10); m_pHLayout->setContentsMargins(QMargins(0, 0, 5, 0)); m_pHLayout->addWidget(m_pLabelIcon); m_pHLayout->addStretch(); QGridLayout *main_layout = new QGridLayout(); main_layout->addWidget(m_pLabelText, 0, 1, Qt::AlignLeft); main_layout->addWidget(m_pLabelIcon, 0, 0, Qt::AlignLeft); setLayout(main_layout); this->setLayout(m_pHLayout); }
void SecondaryDetailWidget::setGameInfo(const DetailGameInfo &info) { __info = info; QLabel* title_zh = new QLabel(QString::fromWCharArray(L"中文:") + info.title_zh); title_zh->setFont(ProfileInstance().AppFont); QLabel* title_en = new QLabel(QString::fromWCharArray(L"英文:") + info.title_en); title_en->setFont(ProfileInstance().AppFont); QLabel* publisher = new QLabel(QString::fromWCharArray(L"发行:") + info.publisher); publisher->setFont(ProfileInstance().AppFont); QLabel* platform = new QLabel(QString::fromWCharArray(L"平台:") + info.platform); platform->setFont(ProfileInstance().AppFont); QLabel* rating = new QLabel(QString::fromWCharArray(L"分级:") + info.rating); rating->setFont(ProfileInstance().AppFont); QLabel* type = new QLabel(QString::fromWCharArray(L"类型:") + info.type); type->setFont(ProfileInstance().AppFont); QLabel* date = new QLabel(QString::fromWCharArray(L"日期:") + info.date); date->setFont(ProfileInstance().AppFont); __topMidLayout->addWidget(title_zh); __topMidLayout->addWidget(title_en); __topMidLayout->addWidget(publisher); __topMidLayout->addWidget(platform); __topMidLayout->addWidget(rating); __topMidLayout->addWidget(type); __topMidLayout->addWidget(date); __topMidLayout->addStretch(); }
SecondaryDetailWidget::SecondaryDetailWidget(int w, int h, bool isGlow, QString pic_name, QString title, QWidget *parent) :QWidget(parent) { QPalette palette; palette.setBrush(QPalette::Window, QBrush(Qt::transparent)); this->setPalette(palette); this->setAutoFillBackground(true); QFont &text_font = const_cast<QFont &>(font()); text_font.setBold(true); setObjectName("SndWidget"); setStyleSheet("QWidget#SndWidget{background:transparent;}"); QPixmap pixmap(pic_name); auto pic_w = pixmap.width(); auto pic_h = pixmap.height(); double ratio = pic_w * 1. / pic_h; double pic_transformed_w = 140 ; double pic_transformed_h = 140 / ratio; pixmap = pixmap.scaled(pic_transformed_w, pic_transformed_h, Qt::AspectRatioMode::KeepAspectRatio, Qt::TransformationMode::SmoothTransformation); m_icon = pixmap; setFont(ProfileInstance().AppFont); m_MouseOver = false; m_MousePress = false; QLabel *widget = new QLabel(); widget->setPixmap(pixmap); QFont font = QFont("Microsoft Yahei"); font.setPixelSize(20); //font.setBold(true); QLabel *lb_title = new QLabel(); lb_title->setText(title); lb_title->setFont(font); QLabel *lb_icon = new QLabel(); lb_icon->setPixmap(m_icon); lb_icon->setFixedSize(pic_transformed_w, pic_transformed_h); if (isGlow) lb_title->setGraphicsEffect(ProfileInstance().generateGlowEffect(Qt::white, 5)); //IconWidget *closeButton = new IconWidget(16, 16, Webbox::Utility::PathUtil::GetCurrentExePath() +"/Skin/icon/UI/close.png", QColor(24, 116, 205), QColor(0, 0, 0), QColor(255, 0, 0)); RoundButton *installButton = new RoundButton(60, 20); installButton->setText(QString::fromWCharArray(L"安装")); //图标 QGridLayout *topLayout = new QGridLayout(); topLayout->setContentsMargins(20, 20, 20, 20); topLayout->setSpacing(30); __topMidLayout = new QVBoxLayout(); __topMidLayout->setSpacing(5); __topMidLayout->setContentsMargins(0, 0, 0, 0); __topMidLayout->addWidget(lb_title); __topMidLayout->addSpacing(10); //__topMidLayout->addStretch(); topLayout->addLayout(__topMidLayout, 0, 1); topLayout->addWidget(lb_icon, 0, 0); QVBoxLayout *bottom_right_layout = new QVBoxLayout(); bottom_right_layout->addStretch(); bottom_right_layout->addWidget(installButton, 0, Qt::AlignRight); QVBoxLayout *top_right_layout = new QVBoxLayout(); //top_right_layout->addWidget(closeButton); top_right_layout->addStretch(); //topLayout->addStretch(); topLayout->addLayout(bottom_right_layout,0,2); //topLayout->addLayout(,0,3); QHBoxLayout *grid_layout = new QHBoxLayout(); grid_layout->addLayout(topLayout); grid_layout->addStretch(); grid_layout->addLayout(top_right_layout); CarouselWidget *carousel_widget = new CarouselWidget(730, 400, 4, 4, 500); QVBoxLayout *main_layout = new QVBoxLayout(); main_layout->setContentsMargins(0, 0, 0, 0); main_layout->setMargin(0); main_layout->setSpacing(0); main_layout->addLayout(grid_layout); main_layout->addSpacing(30); main_layout->addWidget(carousel_widget); main_layout->addStretch(); setLayout(main_layout); }
void Profiler::resize(int size) { if (size <= mSize) return; mSize = size; mPI.resize(mSize,ProfileInstance()); }