/* 初始化相应的信号与槽 */ void TextEditer::initConnection() { /* menuFile里的信号与槽 */ connect(actNew, SIGNAL(triggered()), this, SLOT(doNew())); connect(actOpen, SIGNAL(triggered()), this, SLOT(doOpen())); connect(actClose, SIGNAL(triggered()), this, SLOT(doClose())); connect(actSave, SIGNAL(triggered()), this, SLOT(doSave())); connect(actASave, SIGNAL(triggered()), this, SLOT(doASave())); connect(actExit, SIGNAL(triggered()), this, SLOT(doExit())); /* menuEdit里的信号与槽 */ connect(actUndo, SIGNAL(triggered()), this, SLOT(doUndo())); connect(actRedo, SIGNAL(triggered()), this, SLOT(doRedo())); connect(actCut, SIGNAL(triggered()), this, SLOT(doCut())); connect(actCopy, SIGNAL(triggered()), this, SLOT(doCopy())); connect(actPast, SIGNAL(triggered()), this, SLOT(doPast())); connect(actAll, SIGNAL(triggered()), this, SLOT(doSelectAll())); /* menuTool里的信号与槽 */ connect(actFont, SIGNAL(triggered()), this, SLOT(setFontForText())); /* 当当前文本内容改变后, 自动调用doModified() */ connect(textEdit->document(), SIGNAL(contentsChanged()), this, SLOT(doModified())); /* 当文档修改后, 刷新光标所在的位置 */ connect(textEdit->document(), SIGNAL(contentsChanged()), this, SLOT(doCursorChanged())); }
clblasStatus clblasZcopy( size_t N, const cl_mem X, size_t offx, int incx, cl_mem Y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue *commandQueues, cl_uint numEventsInWaitList, const cl_event *eventWaitList, cl_event *events) { CLBlasKargs kargs; #ifdef DEBUG_COPY printf("\nZCOPY Called\n"); #endif memset(&kargs, 0, sizeof(kargs)); kargs.dtype = TYPE_COMPLEX_DOUBLE; return doCopy(&kargs, N, X, offx, incx, Y, offy, incy, numCommandQueues, commandQueues, numEventsInWaitList, eventWaitList, events); }
void Dialog::saveFile() { rFile = new QFile(fileName); if (!rFile->open(QFile::ReadOnly )) { QMessageBox::warning(this, tr("程序"), tr("无法读取文件 %1:\n%2.") .arg(fileName) .arg(rFile->errorString())); return; } currentFile = fileName.right(fileName.size() - fileName.lastIndexOf('/')-1); wFile = new QFile(currentFile); if (!wFile->open(QFile::WriteOnly )) { QMessageBox::warning(this, tr("程序"), tr("无法写文件 %1:\n%2.") .arg(currentFile) .arg(wFile->errorString())); return; } totalBytes = rFile->size(); bytesToWrite = totalBytes; statusLabel->setText(tr("就绪")); #ifdef USET_TIME_EVENT timeId = startTimer(0); #else doCopy(); #endif }
const Tetrahedron& Tetrahedron::operator=(const Tetrahedron& other) { if(&other != this) { doCopy(other); } return *this; }
void QJDTextBrowser::initConnect() { connect(ui->textEdit,SIGNAL(cursorPositionChanged()),this,SLOT(doCursorChanged())); connect(ui->action_Open,SIGNAL(triggered()),this,SLOT(doOpen())); connect(ui->action_Exit,SIGNAL(triggered()),this,SLOT(doQuit())); connect(ui->action_Copy,SIGNAL(triggered()),this,SLOT(doCopy())); connect(ui->action_All,SIGNAL(triggered()),this,SLOT(doAll())); }
const BoxShape& BoxShape::operator=(const BoxShape& other) { if(&other != this) { doCopy(other); isWall = other.isWall; } return *this; }
const Cube& Cube::operator=(const Cube& other) { if(&other != this) { doCopy(other); isWall = other.isWall; } return *this; }
IOSocket& IOSocket::operator=(const IOSocket& rhs) { if (this != &rhs) { delete fSocket; doCopy(rhs); } return *this; }
SubTabController::SubTabController(SubTabView* subTabView) : OSQObjectController(), m_subTabView(subTabView) { addQObject(subTabView); bool isConnected = false; isConnected = connect(subTabView, SIGNAL(itemSelected(OSItem*)), this, SLOT(selectItem(OSItem*))); BOOST_ASSERT(isConnected); isConnected = connect(subTabView, SIGNAL(itemRemoveClicked(OSItem*)), this, SLOT(removeItem(OSItem*))); BOOST_ASSERT(isConnected); isConnected = connect(subTabView, SIGNAL(itemReplacementDropped(OSItem*, const OSItemId&)), this, SLOT(replaceItem(OSItem*, const OSItemId&))); BOOST_ASSERT(isConnected); isConnected = connect(subTabView, SIGNAL(selectionCleared()), this, SLOT(clearSelection())); BOOST_ASSERT(isConnected); isConnected = connect(subTabView, SIGNAL(itemDropped(const OSItemId&)), this, SLOT(handleDrop(const OSItemId&))); BOOST_ASSERT(isConnected); isConnected = connect(subTabView, SIGNAL(addClicked()), this, SLOT(doAdd())); BOOST_ASSERT(isConnected); isConnected = connect(subTabView, SIGNAL(copyClicked()), this, SLOT(doCopy())); BOOST_ASSERT(isConnected); isConnected = connect(subTabView, SIGNAL(removeClicked()), this, SLOT(doRemove())); BOOST_ASSERT(isConnected); isConnected = connect(subTabView, SIGNAL(purgeClicked()), this, SLOT(doPurge())); BOOST_ASSERT(isConnected); isConnected = connect(subTabView, SIGNAL(openBclDlgClicked()), this, SIGNAL(openBclDlgClicked())); BOOST_ASSERT(isConnected); isConnected = connect(subTabView, SIGNAL(openLibDlgClicked()), this, SIGNAL(openLibDlgClicked())); BOOST_ASSERT(isConnected); isConnected = connect(subTabView, SIGNAL(dropZoneItemClicked(OSItem*)), this, SLOT(inspectItem(OSItem*))); BOOST_ASSERT(isConnected); }
void OSInterface::doCopy(std::string &src, std::string &dst){ std::shared_ptr<Data> data_instance = Data::getInstance(); if(isDir(src)){ //je to adresar OSInterface os; os.getDirInfo(src, "*"); #ifdef __unix__ if(mkdir(dst.c_str(), 0755) == -1) #endif #ifdef __WIN32__ if(mkdir(dst.c_str()) == -1) #endif throw new OSException(src, strerror(errno)); for(auto &a : os.dirs){ // rekurzivni kopie podadresaru std::string nsrc, ndst; nsrc = src; nsrc.push_back(dir_sep); nsrc.append(a->name); ndst = dst; ndst.push_back(dir_sep); ndst.append(a->name); doCopy(nsrc, ndst); } }else{ // kopie souboru pomoci buferu std::ifstream file(src, std::ios::in | std::ios::binary | std::ios::ate); std::ifstream test(dst, std::ios::in | std::ios::binary | std::ios::ate); if(test.tellg() > 0) throw new OSException(dst, "File exists"); test.close(); std::ofstream nfile(dst, std::ios::out | std::ios::binary | std::ios::ate); char buf[data_instance->bufsize]; long long copied = 0; if(!nfile.is_open()) throw new OSException(dst, "Failed to create."); if (file.is_open()) { long long size = file.tellg(); file.seekg (0, std::ios::beg); while(file.good() && !file.eof()){ file.read(buf, data_instance->bufsize); nfile.write(buf, file.gcount()); copied += file.gcount(); if(nfile.fail()) throw new OSException(dst, "Failed to write."); } if(copied != size) throw new OSException(src, "Failed to copy."); }else throw new OSException(src, "Failed to open."); nfile.flush(); file.close(); nfile.close(); } }
ssize_t recvmsg(int s, struct msghdr *msg, int flags) { ssize_t size=getLength(msg); char *buffer = malloc(size); int n; /* bytes left to copy */ if(buffer == NULL) { /* Out of memory */ errno = ENOMEM; return -1; } n = recvfrom(s, buffer, size, flags, msg->msg_name, &msg->msg_namelen); doCopy(msg, buffer, n, 1); free(buffer); return n; }
ssize_t sendmsg (int fd, const struct msghdr *msg, int flags) { ssize_t size=getLength(msg); char *buffer = malloc(size); int n; if(buffer == NULL) { /* Out of memory */ errno = ENOMEM; return -1; } doCopy(msg, buffer, size, 0); n = sendto(fd, buffer, size, flags, msg->msg_name, msg->msg_namelen); free(buffer); return n; }
void OSInterface::copy(cmd_info_T &ci){ QMessageBox *msg_box; std::shared_ptr<Data> data_instance = Data::getInstance(); for(auto src : ci.source_files){ for(auto dstf : ci.destination_files[src]){ msg_box = new QMessageBox(); msg_box->setWindowTitle("copying file"); msg_box->setText(QString::fromStdString("copying\n" + src)); msg_box->setStandardButtons(QMessageBox::NoButton); data_instance->thrs.emplace_back([&]() {try {std::this_thread::yield(); doCopy(src, dstf); } catch(OSException *e){} delete msg_box;}); msg_box->exec(); data_instance->thrs[0].join(); data_instance->thrs.clear(); } } }
void CMainWindow::iniConnect() { connect(textEdit, SIGNAL(cursorPositionChanged()), this, SLOT(doCursorChanged())); connect(actNew, SIGNAL(triggered()), this, SLOT(doNew())); connect(actOpen, SIGNAL(triggered()), this, SLOT(doOpen())); connect(actClose, SIGNAL(triggered()), this, SLOT(doClose())); connect(actSave, SIGNAL(triggered()), this, SLOT(doSave())); connect(actASave, SIGNAL(triggered()), this, SLOT(doASave())); connect(actQuit, SIGNAL(triggered()), this, SLOT(doQuit())); connect(actUndo, SIGNAL(triggered()), this, SLOT(doUndo())); connect(actCut, SIGNAL(triggered()), this, SLOT(doCut())); connect(actCopy, SIGNAL(triggered()), this, SLOT(doCopy())); connect(actPaste, SIGNAL(triggered()), this, SLOT(doPast())); connect(actAll, SIGNAL(triggered()), this, SLOT(doAll())); connect(actFind, SIGNAL(triggered()), this, SLOT(doFind())); connect(textEdit->document(), SIGNAL(contentsChanged()), this, SLOT(doModified())); separatorAct = menu_F->insertSeparator(actQuit); separatorAct->setVisible(false); for (int i = 0; i < MaxRecentFiles; ++i) { recentFileActs[i] = new QAction(this); menu_F->insertAction(separatorAct, recentFileActs[i]); recentFileActs[i]->setVisible(false); connect(recentFileActs[i], SIGNAL(triggered()), this, SLOT(openRecentFile())); } actPrint = menu_T->addAction(tr("打印文档")); connect(actPrint, SIGNAL(triggered()), this, SLOT(doPrint())); }
avrOutputDialog::avrOutputDialog(QWidget *parent, QString prog, QStringList arg, QString wTitle, int closeBehaviour, bool displayDetails) : QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint), ui(new Ui::avrOutputDialog), kill_timer(NULL), hasErrors(false) { ui->setupUi(this); #ifdef __APPLE__ QFont newFont("Courier", 13); ui->plainTextEdit->setFont(newFont); ui->plainTextEdit->setAttribute(Qt::WA_MacNormalSize); #endif #if defined WIN32 || !defined __GNUC__ QFont newFont("Courier", 9); ui->plainTextEdit->setFont(newFont); #endif cmdLine = prog; closeOpt = closeBehaviour; if (cmdLine.isEmpty()) { if (arg.count()<2) { closeOpt = AVR_DIALOG_FORCE_CLOSE; QTimer::singleShot(0, this, SLOT(forceClose())); } else { sourceFile=arg.at(0); destFile=arg.at(1); if (!displayDetails) { ui->plainTextEdit->hide(); QTimer::singleShot(0, this, SLOT(shrink())); } else { ui->checkBox->setChecked(true); } ui->progressBar->setMaximum(127); QTimer::singleShot(500, this, SLOT(doCopy())); } } else { if (wTitle.isEmpty()) setWindowTitle(getProgrammer() + " " + tr("result")); else setWindowTitle(getProgrammer() + " - " + wTitle); QFile exec; winTitle=wTitle; if (!(exec.exists(prog))) { QMessageBox::critical(this, "Companion", getProgrammer() + " " + tr("executable not found")); closeOpt = AVR_DIALOG_FORCE_CLOSE; QTimer::singleShot(0, this, SLOT(forceClose())); } else { foreach(QString str, arg) cmdLine.append(" " + str); lfuse = 0; hfuse = 0; efuse = 0; phase=0; currLine.clear(); if (!displayDetails) { ui->plainTextEdit->hide(); QTimer::singleShot(0, this, SLOT(shrink())); } else { ui->checkBox->setChecked(true); } process = new QProcess(this); connect(process,SIGNAL(readyReadStandardError()), this, SLOT(doAddTextStdErr())); connect(process,SIGNAL(started()),this,SLOT(doProcessStarted())); connect(process,SIGNAL(readyReadStandardOutput()),this,SLOT(doAddTextStdOut())); connect(process,SIGNAL(finished(int)),this,SLOT(doFinished(int))); #if !__GNUC__ kill_timer = new QTimer(this); connect(kill_timer, SIGNAL(timeout()), this, SLOT(killTimerElapsed())); kill_timer->start(2000); #endif process->start(prog,arg); } } }
BoxShape::BoxShape(const BoxShape& other) { doCopy(other); isWall = other.isWall; }
IOSocket::IOSocket(const IOSocket& rhs) { doCopy(rhs); }
FileHandling::FileHandling(QWidget *parent, bool v, QString cf) : MyWidget(parent) { this->setVisibleArea(QSize(600,400)); // Some variables currentfile = cf; verbose = v; QString fileTreeCSS = "QTreeView {"; fileTreeCSS += "color:white;"; fileTreeCSS += "background: rgba(0,0,0,0);"; fileTreeCSS += "show-decoration-selected: 1;"; fileTreeCSS += "}"; fileTreeCSS += "QTreeView::item:hover{"; fileTreeCSS += "background: rgba(255,255,255,128);"; fileTreeCSS += "color: black"; fileTreeCSS += "}"; fileTreeCSS += "QTreeView::item:selected{"; fileTreeCSS += "background: white;"; fileTreeCSS += "color: black;"; fileTreeCSS += "}"; fileTreeCSS += "QTreeView::item:selected:active{"; fileTreeCSS += "background: white;"; fileTreeCSS += "color: black"; fileTreeCSS += "}"; fileTreeCSS += "QTreeView::item:selected:!active{"; fileTreeCSS += "background: white;"; fileTreeCSS += "color: black"; fileTreeCSS += "}"; /********************************** /////////// RENAME //////////////// **********************************/ renameWidget = new QWidget(this); renameLay = new QVBoxLayout; renameTitle = new CustomLabel("<center>" + tr("Rename File") + "</center>"); renameTitle->setFontSize(25); renameTitle->setBold(true); renameOldName = new CustomLabel; renameOldName->setFontSize(15); renameOldName->setItalic(true); renameOldName->setFontColor("grey","grey"); renameOldName->setPadding(10); QHBoxLayout *renameNewLay = new QHBoxLayout; renameNewName = new CustomLineEdit; renameNewName->setFixedWidth(300); renameNewName->setFontSize(15); renameOldEnding = new CustomLabel; renameOldEnding->setFontSize(15); renameNewLay->addStretch(); renameNewLay->addWidget(renameNewName); renameNewLay->addWidget(renameOldEnding); renameNewLay->addStretch(); renameNewNameExists = new CustomLabel(" "); renameNewNameExists->setFontColor("red","red"); renameNewNameExists->setBold(true); renameSave = new CustomPushButton(tr("Save")); renameSave->setPadding(10); renameSave->setFontSize("13pt"); renameSave->setBold(true); renameCancel = new CustomPushButton(tr("Cancel")); renameCancel->setPadding(10); renameCancel->setFontSize("13pt"); renameCancel->setBold(true); renameLay->addStretch(); renameLay->addWidget(renameTitle); renameLay->addWidget(renameOldName); renameLay->addSpacing(5); renameLay->addLayout(renameNewLay); renameLay->addWidget(renameNewNameExists); QHBoxLayout *renameButLay = new QHBoxLayout; renameButLay->addStretch(); renameButLay->addWidget(renameSave); renameButLay->addWidget(renameCancel); renameButLay->addStretch(); renameLay->addLayout(renameButLay); renameLay->addStretch(); connect(renameNewName, SIGNAL(textEdited(QString)), this, SLOT(validateRenameFilename())); connect(renameSave, SIGNAL(clicked()), this, SLOT(doRename())); connect(renameCancel, SIGNAL(clicked()), this, SLOT(animate())); renameWidget->setLayout(renameLay); /********************************** /////////// DELETE //////////////// **********************************/ // On Linux (X11) a "move to trash" is the default (according to freedesktop.org standard). On all other systems, this option is not (yet) available. deleteWidget = new QWidget(this); deleteLay = new QVBoxLayout; deleteTitle = new CustomLabel("<center>" + tr("Delete File") + "</center>"); deleteTitle->setFontSize(15); deleteTitle->setBold(true); deleteFilename = new CustomLabel(" "); deleteFilename->setFontSize(15); deleteFilename->setItalic(true); deleteFilename->setFontColor("grey","grey"); deleteFilename->setPadding(10); deleteQuestion = new CustomLabel("<center>" + tr("Do you really want to delete this file?") +"</center>"); deleteQuestion->setFontSize(15); deleteQuestion->setPadding(10); deleteYesHard = new CustomPushButton(tr("Delete permanently")); deleteYesHard->setPadding(6); #ifdef Q_OS_LINUX deleteYesHard->setFontSize("10pt"); #else deleteYesHard->setFontSize("13pt"); deleteYesHard->setBold(true); #endif #ifdef Q_OS_LINUX deleteYes = new CustomPushButton(tr("Move to Trash")); deleteYes->setPadding(6); deleteYes->setFontSize("13pt"); deleteYes->setBold(true); #else deleteYes = new CustomPushButton; deleteYes->hide(); #endif deleteNo = new CustomPushButton(tr("Cancel")); deleteNo->setPadding(6); deleteNo->setFontSize("13pt"); deleteNo->setBold(true); QHBoxLayout *deleteButLay = new QHBoxLayout; deleteButLay->addStretch(); #ifdef Q_OS_LINUX deleteButLay->addWidget(deleteYes); #else deleteButLay->addWidget(deleteYesHard); #endif deleteButLay->addWidget(deleteNo); deleteButLay->addStretch(); #ifdef Q_OS_LINUX QHBoxLayout *deleteHardButLay = new QHBoxLayout; deleteHardButLay->addStretch(); deleteHardButLay->addWidget(deleteYesHard); deleteHardButLay->addStretch(); #endif deleteLay->addStretch(); deleteLay->addWidget(deleteTitle); deleteLay->addWidget(deleteFilename); deleteLay->addWidget(deleteQuestion); deleteLay->addLayout(deleteButLay); #ifdef Q_OS_LINUX deleteLay->addLayout(deleteHardButLay); #endif deleteLay->addStretch(); connect(deleteYes, SIGNAL(clicked()), this, SLOT(doDelete())); connect(deleteNo, SIGNAL(clicked()), this, SLOT(animate())); QSignalMapper *mapper = new QSignalMapper; mapper->setMapping(deleteYesHard,1); connect(deleteYesHard, SIGNAL(clicked()), mapper, SLOT(map())); connect(mapper, SIGNAL(mapped(int)), this, SLOT(doDelete(int))); deleteWidget->setLayout(deleteLay); /******************************** /////////// MOVE //////////////// ********************************/ moveWidget = new QWidget(this); moveLay = new QVBoxLayout; moveTitle = new CustomLabel("<center>" + tr("Moving File") + "</center>"); moveTitle->setFontSize(25); moveTitle->setBold(true); moveTree = new QTreeView; moveTree->setStyleSheet(fileTreeCSS); moveTree->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); moveTree->setHeaderHidden(true); moveScrollbar = new CustomScrollbar; moveScrollbar->keepAlwaysVisible(true); moveTree->setVerticalScrollBar(moveScrollbar); moveTreeModel = new QFileSystemModel; moveTreeModel->setRootPath(QDir::rootPath()); moveTreeModel->setFilter(QDir::Dirs | QDir::NoDotAndDotDot); moveTree->setCurrentIndex(moveTreeModel->index(QDir::homePath())); moveTree->setModel(moveTreeModel); for(int i = 1; i < moveTreeModel->columnCount(); ++i) moveTree->setColumnHidden(i,true); moveNewNameExists = new CustomLabel(" "); moveNewNameExists->setFontColor("red","red"); moveNewNameExists->setBold(true); moveNewNameLabel = new CustomLabel(tr("Filename") + ":"); moveNewNameLabel->setFontSize(12); moveNewNameLabel->setBold(true); moveNewName = new CustomLineEdit; moveNewName->setFixedWidth(300); moveNewName->setFontSize(12); moveNewNameEnding = new CustomLabel(".xyz"); moveNewNameEnding->setFontSize(12); moveNewNameEnding->setBold(true); QHBoxLayout *moveNewNameLay = new QHBoxLayout; moveNewNameLay->addStretch(); moveNewNameLay->addWidget(moveNewNameLabel); moveNewNameLay->addWidget(moveNewName); moveNewNameLay->addWidget(moveNewNameEnding); moveNewNameLay->addStretch(); moveSave = new CustomPushButton(tr("Move")); moveSave->setPadding(10); moveSave->setFontSize("11pt"); moveSave->setBold(true); moveCancel = new CustomPushButton(tr("Cancel")); moveCancel->setPadding(10); moveCancel->setFontSize("11pt"); moveCancel->setBold(true); QHBoxLayout *moveButLay = new QHBoxLayout; moveButLay->addStretch(); moveButLay->addWidget(moveSave); moveButLay->addWidget(moveCancel); moveButLay->addStretch(); moveLay->addSpacing(20); moveLay->addWidget(moveTitle); moveLay->addWidget(moveTree); moveLay->addWidget(moveNewNameExists); moveLay->addLayout(moveNewNameLay); moveLay->addLayout(moveButLay); moveLay->addSpacing(20); connect(moveCancel, SIGNAL(clicked()), this, SLOT(animate())); connect(moveSave, SIGNAL(clicked()), this, SLOT(doMove())); connect(moveNewName, SIGNAL(textEdited(QString)), this, SLOT(validateMoveAndCopyFilename())); connect(moveTree, SIGNAL(clicked(QModelIndex)), this, SLOT(validateMoveAndCopyFilename())); moveWidget->setLayout(moveLay); /******************************** /////////// COPY //////////////// ********************************/ copyWidget = new QWidget(this); copyLay = new QVBoxLayout; copyTitle = new CustomLabel("<center>" + tr("Copying File") + "</center>"); copyTitle->setFontSize(25); copyTitle->setBold(true); copyTree = new QTreeView; copyTree->setStyleSheet(fileTreeCSS); copyTree->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); copyTree->setHeaderHidden(true); copyScrollbar = new CustomScrollbar; copyScrollbar->keepAlwaysVisible(true); copyTree->setVerticalScrollBar(copyScrollbar); copyTreeModel = new QFileSystemModel; copyTreeModel->setRootPath(QDir::rootPath()); copyTreeModel->setFilter(QDir::Dirs | QDir::NoDotAndDotDot); copyTree->setCurrentIndex(copyTreeModel->index(QDir::homePath())); copyTree->setModel(copyTreeModel); for(int i = 1; i < copyTreeModel->columnCount(); ++i) copyTree->setColumnHidden(i,true); copyNewNameExists = new CustomLabel(" "); copyNewNameExists->setFontColor("red", "red"); copyNewNameExists->setBold(true); copyNewNameLabel = new CustomLabel(tr("Filename") + ":"); copyNewNameLabel->setFontSize(12); copyNewNameLabel->setBold(true); copyNewName = new CustomLineEdit; copyNewName->setFixedWidth(300); copyNewName->setFontSize(12); copyNewNameEnding = new CustomLabel(".xyz"); copyNewNameEnding->setFontSize(12); copyNewNameEnding->setBold(true); QHBoxLayout *copyNewNameLay = new QHBoxLayout; copyNewNameLay->addStretch(); copyNewNameLay->addWidget(copyNewNameLabel); copyNewNameLay->addWidget(copyNewName); copyNewNameLay->addWidget(copyNewNameEnding); copyNewNameLay->addStretch(); copySave = new CustomPushButton(tr("Copy")); copySave->setFontSize("11pt"); copySave->setPadding(10); copySave->setBold(true); copyCancel = new CustomPushButton(tr("Cancel")); copyCancel->setFontSize("11pt"); copyCancel->setPadding(10); copyCancel->setBold(true); QHBoxLayout *copyButLay = new QHBoxLayout; copyButLay->addStretch(); copyButLay->addWidget(copySave); copyButLay->addWidget(copyCancel); copyButLay->addStretch(); copyLay->addSpacing(20); copyLay->addWidget(copyTitle); copyLay->addWidget(copyTree); copyLay->addWidget(copyNewNameExists); copyLay->addLayout(copyNewNameLay); copyLay->addLayout(copyButLay); copyLay->addSpacing(20); connect(copyCancel, SIGNAL(clicked()), this, SLOT(animate())); connect(copySave, SIGNAL(clicked()), this, SLOT(doCopy())); connect(copyNewName, SIGNAL(textEdited(QString)), this, SLOT(validateMoveAndCopyFilename())); connect(copyTree, SIGNAL(clicked(QModelIndex)), this, SLOT(validateMoveAndCopyFilename())); copyWidget->setLayout(copyLay); // Widget layout - only one at a time will be visible allWidgets = new QHBoxLayout; allWidgets->addWidget(renameWidget); allWidgets->addWidget(copyWidget); allWidgets->addWidget(deleteWidget); allWidgets->addWidget(moveWidget); this->setWidgetLayout(allWidgets); // catch finished animation event: connect(this, SIGNAL(notifyOfAniFinished()), this, SLOT(aniFinished())); }
Octahedron::Octahedron(const Octahedron& other) { doCopy(other); }
Tetrahedron::Tetrahedron(const Tetrahedron& other) { doCopy(other); }
Cube::Cube(const Cube& other) { doCopy(other); isWall = other.isWall; }
void U2Panel::keyRel(int key){ cout<<"Key Released :"<<key<<endl; if(aboutDialogShows){ aboutDialogShows=FALSE; repaint(); return; } if(themeDialogShows){ switch(key){ case 4100: themeSelected(); break; case 4114: themeIndex+=themeAvilable.count()-1; themeIndex=themeIndex%themeAvilable.count(); break; case 4116: themeIndex+=1; themeIndex=themeIndex%themeAvilable.count(); break; case 4146: themeDialogShows=FALSE; break; } repaint(); return; } if(selectMode){//选词模式 cout<<"select mode"<<endl; //是数字键 if(key==4100){ //输入 doInput(); num_buf=""; alpha_buf=""; cw_page_list.clear(); cw_list.clear(); selectMode=FALSE; }else if(key>48&&key<58){ doInputByNum(key); num_buf=""; alpha_buf=""; cw_page_list.clear(); cw_list.clear(); selectMode=FALSE; } }else{//非选词模式 cout<<"not select mode"<<endl; if(key>48&&key<58){ if(!menuShows){ num_buf+=QString::number(key-48); //数字发生变化============================================================ numBufChanged(); getCWords(); CWPaging(); } }else if(key==4100){ if(!menuShows){ justTheOne(); num_buf=""; alpha_buf=""; cw_page_list.clear(); cw_list.clear(); }else{ switch(menu_index){ case 0: emit(rejected()); break; case 1: doCopy(); break; case 2: doPaste(); break; case 3: doTheme(); break; case 4: doAbout(); return; break; } menuShows=!menuShows; } }else if(key==4152){ if(num_buf==""){ menuShows=!menuShows; } }else if(key==4154){ emit(accepted()); //接受 } } repaint(); }