void ClientAgent::Init(void) { AdoptSystemColors(); fInput = new VTextControl(BRect(0, fFrame.top, // tmp. will be moved fFrame.right - fFrame.left - 4, fFrame.bottom), "Input", 0, 0, 0, B_FOLLOW_LEFT_RIGHT | B_FOLLOW_BOTTOM); fInput->SetDivider(0); fInput->ResizeToPreferred(); fInput->MoveTo(0, fFrame.bottom - fInput->Frame().Height() - 3); AddChild(fInput); fInput->TextView()->AddFilter(new ClientAgentInputFilter(this)); fInput->Invalidate(); fHistory = new HistoryList(); BRect textrect(2, fFrame.top, fFrame.right - fFrame.left - 1 - B_V_SCROLL_BAR_WIDTH, fFrame.bottom - fInput->Frame().Height() - 8); fText = new RunView(textrect, fId.String(), fActiveTheme, B_FOLLOW_ALL); fText->SetClippingName(fId.String()); if (vision_app->GetBool("timestamp")) fText->SetTimeStampFormat(vision_app->GetString("timestamp_format")); fTextScroll = new BScrollView("textscroll", fText, B_FOLLOW_ALL, 0, false, true, B_PLAIN_BORDER); AddChild(fTextScroll); }
void CheckBoxListItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,const QModelIndex &index) const { bool value = index.data(Qt::CheckStateRole).toBool(); QString text = index.data(Qt::DisplayRole).toString(); // fill style options with item data const QStyle *style = QApplication::style(); QStyleOptionButton opt; opt.state |= value ? QStyle::State_On : QStyle::State_Off; opt.state |= QStyle::State_Enabled; opt.text = text; opt.rect = QRect(option.rect.x(),option.rect.y(),16,16); QRect textrect(option.rect.x() + 16,option.rect.y(),option.rect.width() - 16,option.rect.height()); style->drawPrimitive(QStyle::PE_IndicatorCheckBox,&opt,painter); style->drawItemText(painter,textrect,Qt::AlignLeft,opt.palette,true,text); }