Osp::Ui::Controls::ListItemBase* Form1::CreateItem(int itemIndex, int itemWidth) { String text; text.Format(100, L"SimpleItem #%d", itemIndex); AppResource * res = Application::GetInstance()->GetAppResource(); Bitmap * pBitmap = res->GetBitmapN(L"itemicon.png", BITMAP_PIXEL_FORMAT_ARGB8888); SimpleItem * pItem = new SimpleItem(); pItem->Construct(Dimension(itemWidth, 100), LIST_ANNEX_STYLE_DETAILED); pItem->SetElement(text, pBitmap); ListContextItem* pItemContext = new ListContextItem(); pItemContext->Construct(); pItemContext->AddElement(0, "Call"); pItemContext->AddElement(1, "Send SMS"); pItemContext->AddElement(2, "Send e-mail"); pItem->SetContextItem(pItemContext); delete pBitmap; return pItem; }
int main(int argc, char** argv) { QApplication app(argc, argv); QWidget wgt; QGraphicsScene scene(QRectF(-100, -100, 640, 480)); MyView* pView = new MyView(&scene); QPushButton* pcmdZoomIn = new QPushButton("&Zoom In"); QPushButton* pcmdZoomOut = new QPushButton("Z&oom Out"); QPushButton* pcmdRotateLeft = new QPushButton("&Rotate Left"); QPushButton* pcmdRotateRight = new QPushButton("Ro&tate Right"); pView->setRenderHint(QPainter::Antialiasing, true); QGraphicsPixmapItem* pPixmapItem = scene.addPixmap(QPixmap("aBYKS749x88.jpg")); pPixmapItem->setFlags(QGraphicsItem::ItemIsMovable); for(int i = 0; i < 20; i++) { SimpleItem* pSimpleItem = new SimpleItem; scene.addItem(pSimpleItem); pSimpleItem->setPos(i*30, 0); pSimpleItem->setFlags(QGraphicsItem::ItemIsMovable); pSimpleItem->setParentItem(pPixmapItem); } QObject::connect(pcmdZoomIn, SIGNAL(clicked()), pView, SLOT(slotZoomIn())); QObject::connect(pcmdZoomOut, SIGNAL(clicked()), pView, SLOT(slotZoomOut())); QObject::connect(pcmdRotateLeft, SIGNAL(clicked()), pView, SLOT(slotRotateLeft())); QObject::connect(pcmdRotateRight,SIGNAL(clicked()), pView, SLOT(slotRotateRight())); QVBoxLayout* pvbxLayout = new QVBoxLayout; pvbxLayout->addWidget(pView); pvbxLayout->addWidget(pcmdZoomIn); pvbxLayout->addWidget(pcmdZoomOut); pvbxLayout->addWidget(pcmdRotateLeft); pvbxLayout->addWidget(pcmdRotateRight); wgt.setLayout(pvbxLayout); wgt.show(); return app.exec(); }
Tizen::Ui::Controls::ListItemBase* ProfileListForm::CreateItem(int index, int itemWidth) { SimpleItem* pItem = new SimpleItem(); AppAssert(pItem); pItem->Construct(Tizen::Graphics::Dimension(itemWidth, 100), LIST_ANNEX_STYLE_DETAILED); String *str = static_cast<String*>(__pTitleList.GetAt(index)); pItem->SetElement(*str, null); ListContextItem* pContextItem = new ListContextItem(); String getDelete; Application::GetInstance()->GetAppResource()->GetString(IDS_DELETE, getDelete); pContextItem->Construct(); pContextItem->AddElement(IDA_ITEM_DELETE, getDelete); pItem->SetContextItem(pContextItem); return pItem; }
void dController::printOverSide(int RowId) { //TODO это должно быть в отдельном классе !!! QGraphicsScene *scene = new QGraphicsScene(); bool page_orient= false; int margin_top = MM_TO_POINT(15); int margin_bottom=MM_TO_POINT(15); int margin_left=MM_TO_POINT(35); int margin_right=MM_TO_POINT(15); int page_width=210; int page_height=297; scene->clear(); scene->setSceneRect(0, 0, MM_TO_POINT(page_width),MM_TO_POINT(page_height)); QGraphicsRectItem *border_rect = new QGraphicsRectItem (QRectF(margin_left, margin_top, MM_TO_POINT(page_width)-margin_left-margin_right,MM_TO_POINT(page_height)-margin_top-margin_bottom)); qDebug() <<"margin_rect"<< margin_left << margin_top << margin_left<<margin_right; border_rect->setPen(QPen(Qt::black,2,Qt::DotLine)); border_rect->setBrush(QBrush(Qt::white)); border_rect->setOpacity(0.5); border_rect->setZValue(0); //border_rect->setData(ObjectName, "Border"); scene->addItem(border_rect); SimpleItem* MBitem = new SimpleItem; MBitem->setPos(MM_TO_POINT(5), MM_TO_POINT(280)); MBitem->setPrintFrame(false); MBitem->setText(QStringList()<<QString("МБ №-%1")); MBitem->setFlag(QGraphicsItem::ItemIsMovable); MBitem->setParentItem(border_rect); //scene->addItem(MBtem); scene->update(); QPrinter printer; printer.setPrinterName(curPrinter); //Печать на реальный принтер //printer.setOutputFormat(QPrinter::PdfFormat); //printer.setOutputFileName("overside.pdf"); //printer.setPageSize(QPrinter::A4); QPainter painter(&printer); scene->render(&painter); //emit sayMeGood(); }
void dController::printWithTemplate (int RowId) { qDebug()<<Q_FUNC_INFO; //TODO это должно быть в отдельном классе !!! QGraphicsScene * scene = new QGraphicsScene(); bool page_orient= false; int margin_top = MM_TO_POINT(15); int margin_bottom=MM_TO_POINT(15); int margin_left=MM_TO_POINT(35); int margin_right=MM_TO_POINT(15); int page_width=210; int page_height=297; scene->clear(); scene->setSceneRect(0, 0, MM_TO_POINT(page_width),MM_TO_POINT(page_height)); QGraphicsRectItem *border_rect = new QGraphicsRectItem (QRectF(margin_left, margin_top, MM_TO_POINT(page_width)-margin_left-margin_right,MM_TO_POINT(page_height)-margin_top-margin_bottom)); qDebug() <<"margin_rect"<< margin_left << margin_top << margin_left<<margin_right; border_rect->setPen(QPen(Qt::black,2,Qt::DotLine)); border_rect->setBrush(QBrush(Qt::white)); border_rect->setOpacity(0.5); border_rect->setZValue(0); //border_rect->setData(ObjectName, "Border"); scene->addItem(border_rect); SimpleItem* Gritem = new SimpleItem; Gritem->setPos(MM_TO_POINT(180), MM_TO_POINT(0)); Gritem->setPrintFrame(false); Gritem->setText(QStringList()<<QString("Секретно")<<QString("Пункт 12")); Gritem->setFlag(QGraphicsItem::ItemIsMovable); Gritem->setParentItem(border_rect); SimpleItem* MBitem = new SimpleItem; MBitem->setPos(MM_TO_POINT(5), MM_TO_POINT(280)); MBitem->setPrintFrame(false); MBitem->setText(QStringList()<<QString("МБ №-%1"));//.arg(templ)); MBitem->setFlag(QGraphicsItem::ItemIsMovable); scene->addItem(MBitem);//->setParentItem(border_rect); scene->update(); QPrinter printer; QString with_t; with_t.append(spoolDIR).append("compl_teml2.pdf"); printer.setOutputFormat(QPrinter::PdfFormat); printer.setOutputFileName(with_t); printer.setPageSize(QPrinter::A4); QPainter painter(&printer); scene->render(&painter); //QString in_file =mainPDF; //in_file.arg(QString(SID)); qDebug() <<Q_FUNC_INFO<< mainPDF << outPDF; this->mergeTwoPDF(mainPDF,with_t,outPDF); // Рисуем последнюю страничку scene->clear(); border_rect = new QGraphicsRectItem (QRectF(margin_left, margin_top, MM_TO_POINT(page_width)-margin_left-margin_right,MM_TO_POINT(page_height)-margin_top-margin_bottom)); qDebug() <<"margin_rect"<< margin_left << margin_top << margin_left<<margin_right; border_rect->setPen(QPen(Qt::black,2,Qt::DotLine)); border_rect->setBrush(QBrush(Qt::white)); border_rect->setOpacity(0.5); border_rect->setZValue(0); //border_rect->setData(ObjectName, "Border"); scene->addItem(border_rect); SimpleItem* Lastitem = new SimpleItem; Lastitem->setPos(MM_TO_POINT(40), MM_TO_POINT(200)); Lastitem->setPrintFrame(true); Lastitem->setText(QStringList()<<QString("Секретно") <<QString("Пункт 12") <<QString("Исполнитель:ФИО исполнителя") <<QString("Отпечатал:ФИО кто печатал") <<QString("Телефон:2-63-15") <<QString("Инв.№ 12/13") <<QString("Дата: 09.09.09'") <<QString("МБ №-%1"));//.arg(templ) //); Lastitem->setFlag(QGraphicsItem::ItemIsMovable); scene->addItem(Lastitem);//->setParentItem(border_rect); QPrinter printer2; printer2.setOutputFormat(QPrinter::PdfFormat); QString last_p; last_p.append(spoolDIR).append("last_page.pdf"); printer2.setOutputFileName(last_p); printer2.setPageSize(QPrinter::A4); QPainter painter2(&printer2); scene->render(&painter2); // emit sayMeGood(); }
Tizen::Ui::Controls::ListItemBase* EventListForm::CreateItem(int groupIndex, int index, int itemWidth) { SimpleItem* pItem = new (std::nothrow) SimpleItem(); pItem->Construct(Dimension(itemWidth, H_ITEM), LIST_ANNEX_STYLE_NORMAL); String listItemString; CalEventInstance* pEventInstance = null; switch (groupIndex) { case GROUP_INDEX_ALL_DAY_EVENT: { pEventInstance = GetAllDayEventAt(index); if (pEventInstance != null) { listItemString = pEventInstance->GetSubject(); if (listItemString.IsEmpty() == true) { listItemString = L"제목 없음"; } } else { if (index == 0) { listItemString = L"일정 없음"; } } } break; case GROUP_INDEX_NON_ALL_DAY_EVENT: { pEventInstance = GetNonAllDayEventAt(index); if (pEventInstance != null) { listItemString = pEventInstance->GetSubject(); if (listItemString.IsEmpty() == true) { listItemString = L"제목 없음"; } } else { if (index == 0) { listItemString = L"일정 없음"; } } } break; default: break; } pItem->SetElement(listItemString); return pItem; }