本文整理汇总了C++中ImageResource::fromQImage方法的典型用法代码示例。如果您正苦于以下问题:C++ ImageResource::fromQImage方法的具体用法?C++ ImageResource::fromQImage怎么用?C++ ImageResource::fromQImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageResource
的用法示例。
在下文中一共展示了ImageResource::fromQImage方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateImage
void PaintChatWindow::updateImage(){
if(paintChatService->receivedInit(peerId)){
ui->paintWidget->fillImage(Qt::white);
ImageResource res;
res.fromQImage(ui->paintWidget->getImage());
paintChatService->init(peerId,res);
}else{
ImageResource res;
res.fromQImage(ui->paintWidget->getImage());
ui->paintWidget->setImage(paintChatService->update(peerId,res).toQImage());
}
}
示例2: on_pushButtonClear_clicked
void PaintChatWindow::on_pushButtonClear_clicked()
{
//käse tut ned, vermutlich wegen gleichen timestamps
/*
// not the best way to reset the image, because it causes the entire image to be transmitted
// first overwrite with black
ui->paintWidget->fillImage(Qt::black);
updateImage();
// then with white
ui->paintWidget->fillImage(Qt::white);
updateImage();
*/
// andere Lösung:
// sendet viele bytes, weil resource unkomprimiert ist
// tut nicht, vielleicht zu große items?
ui->paintWidget->fillImage(Qt::white);
ImageResource res;
res.fromQImage(ui->paintWidget->getImage());
paintChatService->init(peerId,res);
paintChatService->sendInit(peerId,res);
}
示例3: pix
PaintChatWindow::PaintChatWindow(QWidget *parent, std::string peerId, ChatWidget *chatWidget) :
QMainWindow(parent), peerId(peerId), chatType(ChatWidget::CHATTYPE_UNKNOWN), chatWidget(chatWidget),
ui(new Ui::PaintChatWindow)
{
ui->setupUi(this);
connect(ui->paintWidget,SIGNAL(haveUpdate()),SLOT(on_haveUpdate()));
connect(ui->penWidthSpinBox,SIGNAL(valueChanged(int)),this,SLOT(penChanged()));
ui->pushButton1px->setChecked(true);
ui->pushButtonPen->setChecked(true);
ui->paintWidget->color=Qt::black;
ui->paintWidget->penWidth=1;
timer=new QTimer(this);
connect(timer,SIGNAL(timeout()),SLOT(on_timer()));
timer->start(500);
QIcon icon ;
icon.addPixmap(QPixmap(":/images/colors.png"));
setWindowIcon(icon);
QPixmap pix(24, 24);
pix.fill(currentColor);
ui->pushButtonPrimaryColor->setIcon(pix);
chatType = chatWidget->chatType();
if(chatType == ChatWidget::CHATTYPE_PRIVATE)
{
ui->label->setText(QString::fromStdString(std::string("Paintchat with ")+rsPeers->getPeerName(peerId)));
setWindowTitle(QString::fromStdString(rsPeers->getPeerName(peerId)+" - PaintChat"));
ImageResource res;
res.fromQImage(ui->paintWidget->getImage());
paintChatService->init(peerId,res);
ui->progressBar->hide();
}
if(chatType == ChatWidget::CHATTYPE_LOBBY)
{
ui->progressBar->setRange(0,100);
ui->progressBar->setValue(0);
ChatLobbyId id;
rsMsgs->isLobbyId(peerId, id);
std::string nick, lobby;
std::list<ChatLobbyInfo> cil;
rsMsgs->getChatLobbyList(cil);
std::list<ChatLobbyInfo>::iterator it;
for(it = cil.begin(); it != cil.end(); it++)
{
ChatLobbyInfo ci = *it;
if(ci.lobby_id == id)
{
nick = ci.nick_name;
lobby = ci.lobby_name;
break;
}
}
std::string label = nick + "@" + lobby;
ui->label->setText(QString::fromStdString(label));
setWindowTitle(QString::fromStdString(label + " - PaintChat"));
}
}