Exemplo n.º 1
0
void BuildGroupUI::sureClicked()
{
    QString title = mEd->text();
    if (title.length() > 50)
    {
        NotifyUI::ShowNotify(cns("名称不能过长"));
//        QMessageBox::information(this, cns("提示"), cns("昵称不能过长"), cns("吼啊"));
        return;
    }
    if (title.isEmpty() || title.isNull())
    {
        NotifyUI::ShowNotify(cns("群名称不能为空"));
//        QMessageBox::information(this, cns("提示"), cns("昵称不能为空"), cns("吼啊"));
        return;
    }
    QStringList lst = mMembers->getChoiceMembers();
    QString uuid = getUuid();
    emit signalCreateGroup(title, uuid, lst, 1);
    close();
}
void WidgetMain::initData()
{
	//设置TreeWidget的font大小
	{
		auto font = treeWidget->font();
		font.setPixelSize(11);
		treeWidget->setFont(font);
	}
	pushButtonInfor->installEventFilter(this);

    pDustbin_ = new Label(this);//还可以用他的hover,通过eventfilter
    pDustbin_->hide();

	pBackStart_ = new QLabel(this);
	pBackStart_->installEventFilter(this);
	QPixmap pix("./resource/images/bb/JumpToStart_idle.png");
	pBackStart_->resize(pix.size());
	pBackStart_->setPixmap(pix);
	{
		int y = widgetTitle->height()+widgetMenu->height()+10+255;
		pBackStart_->move(widgetLeft->width()+10, y);
	}
	//pBackStart_->setOpacity(0);
	pBackStart_->hide();

	pSerialPortToolLabel_ = new FunctionAreaWidget(this);
	connect(pSerialPortToolLabel_, SIGNAL(signalClick()), this, SLOT(slotCreateSerialTool()));
	pSerialPortToolLabel_->addData(QPixmap("./resource/images/tool_area/TopToolBar_Serial.png"), "Serial");
	pSerialPortToolLabel_->move(this->width()-200, 31);
	pSerialPortToolLabel_->show();
    {
        QPixmap pix("./resource/images/tool_area/TopToolBar_del");
        pDustbin_->resize(pix.size());
        pDustbin_->setPixmap(pix);
    }

    labelLogo->installEventFilter(this);
    pDustbin_->installEventFilter(this);
    widgetLeft->installEventFilter(this);

    pAllBlockMenu_ = new QMenu(this);

    {
        // 啦拉拉在这里检测所有的模块
        QString path = "./resource/Blocks";
        QDir dir(path);
        dir.setFilter(QDir::AllDirs | QDir::NoDotAndDotDot);
        foreach (const QString &dirName, dir.entryList())
        {
            //ListWidgetItem
            QString dirPath = path + "/" +dirName;
            QTreeWidgetItem *pTreeItem = new QTreeWidgetItem(treeWidget, QStringList(dirName));
            pTreeItem->setSizeHint(0, QSize(100,20));
            pTreeItem->setData(0,Qt::UserRole+1,dirPath);
            map_treeWidgetItemPointer_pageIndex_.insert(pTreeItem, pageIndex_++);
            //menu
            QMenu *pMenu = pAllBlockMenu_->addMenu(dirName);
            scanBlocks(dirPath, pTreeItem, pMenu);
        }
        {
            //treeWidget->setCurrentIndex(treeWidget->indexAt(QPoint(5, 5)));
        }
    }

    {
        QPixmap pixNormal("./resource/images/common/Blocks_Begin.png");
        QPixmap pixHover("./resource/images/common/Blocks_Begin_p.png");
        QPixmap pixPressed("./resource/images/common/Blocks_Begin_o.png");
        pixNormal.scaled(QSize(26, 26));
        pixHover.scaled(QSize(26, 26));
        QListWidgetItem *pItem = new QListWidgetItem("");
        pItem->setSizeHint(QSize(38, 38));//26*26
        BlockMenuWidget *pWidget = new BlockMenuWidget(pixNormal, pixHover, pixPressed);

        listWidgetMenu->addItem(pItem);
        listWidgetMenu->setItemWidget(pItem, pWidget);
    }
    {
        QPixmap pixNormal("./resource/images/common/Blocks_All.png");
        QPixmap pixHover("./resource/images/common/Blocks_All_p.png");
        QPixmap pixPressed("./resource/images/common/Blocks_All_o.png");
        pixNormal.scaled(QSize(26, 26));
        pixHover.scaled(QSize(26, 26));
        QListWidgetItem *pItem = new QListWidgetItem("");
        pItem->setSizeHint(QSize(38, 38));
        BlockMenuWidget *pWidget = new BlockMenuWidget(pixNormal, pixHover, pixPressed);

        listWidgetMenu->addItem(pItem);
        listWidgetMenu->setItemWidget(pItem, pWidget);
    }
    connect(listWidgetMenu, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this,
                                   SLOT(slotCurrentItemChanged(QListWidgetItem*,QListWidgetItem*)));

    pEditScene_ = new EditScene(QRectF(0, 0, 840, 640), widgetShowScene);
    pEditScene_->setWidgetMain(this);
    pEditScene_->setComponentData(&hash_blockPath_blockData_);
    pEditScene_->addModuleTagData(map_moduleName_moduleTag_);
    widgetShowScene->setScenePointer(pEditScene_ );
    //	pEditScene_->setListWidgetModulePointer(listWidget);
	connect(pEditScene_, SIGNAL(signalViewOffset(QPoint)), this, SLOT(slotViewOffset(QPoint)));
    connect(pEditScene_, SIGNAL(signalShowSubWindows()), this, SLOT(slotShowSubWindows()));
    connect(pEditScene_, SIGNAL(signalFocusInLine(FlowLine*,QString,QString)), this,
            SLOT(slotFocusInLine(FlowLine*,QString,QString)));
    connect(pEditScene_, SIGNAL(signalFocusInGroup(QString)), this, SLOT(slotFocusInGroup(QString)));
    connect(this, SIGNAL(signalCreateGroup(QString)), pEditScene_, SLOT(slotCreateGroup(QString)));

    createListWidget();
    pListWidget_ = static_cast<ListWidgetAdvanceBlock*>(stackedWidgetBlockType->currentWidget());

	QTimer::singleShot(50, this, SLOT(slotOpenAutoUpdate()));
}