本文整理汇总了C++中QC_ApplicationWindow类的典型用法代码示例。如果您正苦于以下问题:C++ QC_ApplicationWindow类的具体用法?C++ QC_ApplicationWindow怎么用?C++ QC_ApplicationWindow使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QC_ApplicationWindow类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: closeEditBlockWindow
/**
* Closes all windows that are editing the given block.
*/
void QC_DialogFactory::closeEditBlockWindow(RS_Block* block) {
RS_DEBUG->print("QC_DialogFactory::closeEditBlockWindow");
QC_ApplicationWindow* appWindow = QC_ApplicationWindow::getAppWindow();
QMdiArea* mdiAreaCAD = appWindow->getMdiArea();
if (mdiAreaCAD!=NULL) {
RS_DEBUG->print("QC_DialogFactory::closeEditBlockWindow: workspace found");
QList<QMdiSubWindow*> windows = mdiAreaCAD->subWindowList();
for (int i = 0; i <windows.size(); ++i) {
RS_DEBUG->print("QC_DialogFactory::closeEditBlockWindow: window: %d",
i);
QC_MDIWindow* m = qobject_cast<QC_MDIWindow*>(windows.at(i)->widget());
if (m!=NULL) {
RS_DEBUG->print(
"QC_DialogFactory::closeEditBlockWindow: got mdi");
if (m->getDocument()==block) {
RS_DEBUG->print(
"QC_DialogFactory::closeEditBlockWindow: closing mdi");
//m->closeMDI(true, false);
m->setAttribute(Qt::WA_DeleteOnClose);//RLZ: to ensure the window is deleted
m->close();
}
}
}
}
QMdiSubWindow* subWindow=NULL;
appWindow->slotWindowActivated(subWindow);
RS_DEBUG->print("QC_DialogFactory::closeEditBlockWindow: OK");
}
示例2: main
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QC_ApplicationWindow w;
w.show();
return a.exec();
}
示例3: trigger
void RS_ActionBlocksSave::trigger() {
RS_DEBUG->print("save block to file");
QC_ApplicationWindow* appWindow = QC_ApplicationWindow::getAppWindow();
if(!appWindow) {
finish(false);
return;
}
RS_BlockList* bList = appWindow->getBlockWidget() -> getBlockList();
if (bList) {
auto b=bList->getActive();
if(b) {
RS_Graphic g(nullptr);
g.setOwner(false);
g.clearLayers();
// g.addLayer(b->getLayer());
for (RS_Entity* e=b->firstEntity(RS2::ResolveNone);
e;
e = b->nextEntity(RS2::ResolveNone)) {
g.addEntity(e);
if (e->rtti() == RS2::EntityInsert) {
RS_Insert *in = static_cast<RS_Insert *>(e);
g.addBlock(in->getBlockForInsert());
addBlock(in,&g);
}
// std::cout<<__FILE__<<" : "<<__func__<<" : line: "<<__LINE__<<" : "<<e->rtti()<<std::endl;
// g.addLayer(e->getLayer());
// std::cout<<__FILE__<<" : "<<__func__<<" : line: "<<__LINE__<<" : "<<e->rtti()<<std::endl;
}
// std::cout<<__FILE__<<" : "<<__func__<<" : line: "<<__LINE__<<std::endl;
// std::cout<<"add layer name="<<qPrintable(b->getLayer()->getName())<<std::endl;
RS2::FormatType t = RS2::FormatDXFRW;
QG_FileDialog dlg(appWindow->getMDIWindow(),0, QG_FileDialog::BlockFile);
QString const& fn = dlg.getSaveFile(&t);
QApplication::setOverrideCursor( QCursor(Qt::WaitCursor) );
// g.setModified(true);
g.saveAs(fn, t);
QApplication::restoreOverrideCursor();
} else {
if (RS_DIALOGFACTORY) {
RS_DIALOGFACTORY->commandMessage(tr("No block activated to save"));
}
}
} else {
RS_DEBUG->print(RS_Debug::D_WARNING,
"RS_ActionBlocksSave::trigger(): blockList is NULL");
}
finish(false);
}
示例4: requestEditBlockWindow
/**
* Provides a new window for editing the active block.
*/
void QC_DialogFactory::requestEditBlockWindow(RS_BlockList* blockList) {
RS_DEBUG->print("QC_DialogFactory::requestEditBlockWindow()");
QC_ApplicationWindow* appWindow = QC_ApplicationWindow::getAppWindow();
QC_MDIWindow* parent = appWindow->getMDIWindow();
if (parent!=NULL) {
//RS_BlockList* blist = blockWidget->getBlockList();
if (blockList!=NULL) {
RS_Block* blk = blockList->getActive();
if (blk!=NULL) {
QC_MDIWindow* w = appWindow->slotFileNew(blk);
// the parent needs a pointer to the block window and
// vice versa
parent->addChildWindow(w);
w->getGraphicView()->zoomAuto(false);
}
}
}
}
示例5: closeEditBlockWindow
/**
* Closes all windows that are editing the given block.
*/
void QC_DialogFactory::closeEditBlockWindow(RS_Block* block) {
RS_DEBUG->print("QC_DialogFactory::closeEditBlockWindow");
QC_ApplicationWindow* appWindow = QC_ApplicationWindow::getAppWindow();
QMdiArea* mdiAreaCAD = appWindow->getMdiArea();
if (mdiAreaCAD==NULL) return; //should not happen
RS_DEBUG->print("QC_DialogFactory::closeEditBlockWindow: workspace found");
for (int i = 0; i <mdiAreaCAD->subWindowList().size(); ) {
RS_DEBUG->print("QC_DialogFactory::closeEditBlockWindow: window: %d",
i);
QC_MDIWindow* m = qobject_cast<QC_MDIWindow*>(mdiAreaCAD->subWindowList().at(i));
if(m==NULL) {
mdiAreaCAD->removeSubWindow(mdiAreaCAD->subWindowList().at(i));
continue;
}
RS_DEBUG->print(
"QC_DialogFactory::closeEditBlockWindow: got mdi");
if (m->getDocument()==block) {
RS_DEBUG->print(
"QC_DialogFactory::closeEditBlockWindow: closing mdi");
appWindow->slotFilePrintPreview(false);
m->closeMDI(true, false);
mdiAreaCAD->removeSubWindow(mdiAreaCAD->subWindowList().at(i));
continue;
// m->setAttribute(Qt::WA_DeleteOnClose);//RLZ: to ensure the window is deleted
// m->close();
}
i++;
}
//activate a subWindow, bug#3486357
QMdiSubWindow* subWindow=mdiAreaCAD->currentSubWindow();
appWindow->slotWindowActivated(subWindow);
RS_DEBUG->print("QC_DialogFactory::closeEditBlockWindow: OK");
}
示例6: requestEditBlockWindow
/**
* Provides a new window for editing the active block.
*/
void QC_DialogFactory::requestEditBlockWindow(RS_BlockList* /*blockList*/) {
RS_DEBUG->print("QC_DialogFactory::requestEditBlockWindow()");
QC_ApplicationWindow* appWindow = QC_ApplicationWindow::getAppWindow();
QC_MDIWindow* parent = appWindow->getMDIWindow();
if (parent!=NULL) {
//get blocklist from block widget, bug#3497154
RS_BlockList* blist = appWindow->getBlockWidget() -> getBlockList();
if (blist !=NULL) {
RS_Block* blk = blist->getActive();
// std::cout<<"QC_DialogFactory::requestEditBlockWindow(): size()="<<((blk==NULL)?0:blk->count() )<<std::endl;
if (blk!=NULL) {
QC_MDIWindow* w = appWindow->slotFileNew(blk);
// the parent needs a pointer to the block window and
// vice versa
parent->addChildWindow(w);
w->getGraphicView()->zoomAuto(false);
//update grid settings, bug#3443293
w->getGraphicView()->getGrid()->updatePointArray();
}
}
}
}
示例7: main
//.........这里部分代码省略.........
RS_SETTINGS->writeEntry("/Language", lang);
}
langCmd = RS_SETTINGS->readEntry("/LanguageCmd", "");
if (langCmd.isEmpty()) {
langCmd=QC_PREDEFINED_LOCALE;
RS_SETTINGS->writeEntry("/LanguageCmd", langCmd);
}
#else
lang = RS_SETTINGS->readEntry("/Language", "en");
langCmd = RS_SETTINGS->readEntry("/LanguageCmd", "en");
#endif
RS_SETTINGS->endGroup();
RS_SYSTEM->loadTranslation(lang, langCmd);
RS_DEBUG->print("main: loading translation: OK");
#ifdef QSPLASHSCREEN_H
splash = new QSplashScreen(*pixmap);
splash->show();
splash->showMessage(QObject::tr("Loading.."),
Qt::AlignRight|Qt::AlignBottom, QC_SPLASH_TXTCOL);
RS_DEBUG->print("main: splashscreen: OK");
#endif
//QApplication::setStyle(new QWindowsStyle());
//QApplication::setStyle(new QPlatinumStyle());
#ifdef QC_BUILTIN_STYLE //js:
RS_DEBUG->print("main: applying built in style..");
applyBuiltinStyle();
#endif
RS_DEBUG->print("main: creating main window..");
QC_ApplicationWindow * appWin = new QC_ApplicationWindow();
RS_DEBUG->print("main: setting caption");
appWin->setWindowTitle(XSTR(QC_APPNAME));
RS_DEBUG->print("main: show main window");
appWin->show();
RS_DEBUG->print("main: set focus");
appWin->setFocus();
RS_DEBUG->print("main: creating main window: OK");
#ifdef QSPLASHSCREEN_H
if (splash) {
RS_DEBUG->print("main: updating splash..");
splash->showMessage(QObject::tr("Loading..."),
Qt::AlignRight|Qt::AlignBottom, QC_SPLASH_TXTCOL);
RS_DEBUG->print("main: processing events");
qApp->processEvents();
RS_DEBUG->print("main: updating splash: OK");
}
#endif
// Set LC_NUMERIC so that enetring numeric values uses . as teh decimal seperator
setlocale(LC_NUMERIC, "C");
RS_DEBUG->print("main: loading files..");
bool files_loaded = false;
for (QStringList::Iterator it = fileList.begin(); it != fileList.end();
++it ) {
#ifdef QSPLASHSCREEN_H
if (splash) {
splash->showMessage(QObject::tr("Loading File %1..")
.arg(QDir::toNativeSeparators(*it)),
Qt::AlignRight|Qt::AlignBottom, QC_SPLASH_TXTCOL);
示例8: main
//.........这里部分代码省略.........
bool show_splash = settings.value("Startup/ShowSplash", 1).toBool();
if (show_splash)
{
QPixmap pixmap(":/main/splash_librecad.png");
splash->setPixmap(pixmap);
splash->setAttribute(Qt::WA_DeleteOnClose);
splash->show();
splash->showMessage(QObject::tr("Loading.."),
Qt::AlignRight|Qt::AlignBottom, Qt::black);
app.processEvents();
RS_DEBUG->print("main: splashscreen: OK");
}
RS_DEBUG->print("main: init fontlist..");
RS_FONTLIST->init();
RS_DEBUG->print("main: init fontlist: OK");
RS_DEBUG->print("main: init patternlist..");
RS_PATTERNLIST->init();
RS_DEBUG->print("main: init patternlist: OK");
RS_DEBUG->print("main: loading translation..");
settings.beginGroup("Appearance");
QString lang = settings.value("Language", "en").toString();
QString langCmd = settings.value("LanguageCmd", "en").toString();
settings.endGroup();
RS_SYSTEM->loadTranslation(lang, langCmd);
RS_DEBUG->print("main: loading translation: OK");
RS_DEBUG->print("main: creating main window..");
QC_ApplicationWindow appWin;
RS_DEBUG->print("main: setting caption");
appWin.setWindowTitle(app.applicationName());
RS_DEBUG->print("main: show main window");
settings.beginGroup("Geometry");
int windowWidth = settings.value("WindowWidth", 1024).toInt();
int windowHeight = settings.value("WindowHeight", 1024).toInt();
int windowX = settings.value("WindowX", 32).toInt();
int windowY = settings.value("WindowY", 32).toInt();
settings.endGroup();
if (!first_load)
appWin.resize(windowWidth, windowHeight);
appWin.move(windowX, windowY);
bool maximize = settings.value("Startup/Maximize", 0).toBool();
if (maximize || first_load)
appWin.showMaximized();
else
appWin.show();
RS_DEBUG->print("main: set focus");
appWin.setFocus();
RS_DEBUG->print("main: creating main window: OK");
if (show_splash)
{
RS_DEBUG->print("main: updating splash");
splash->raise();
示例9: main
//.........这里部分代码省略.........
#else
lang = RS_SETTINGS->readEntry("/Language", "en");
langCmd = RS_SETTINGS->readEntry("/LanguageCmd", "en");
#endif
RS_SETTINGS->endGroup();
RS_SYSTEM->loadTranslation(lang, langCmd);
RS_DEBUG->print("main: loading translation: OK");
#ifdef QSPLASHSCREEN_H
RS_SETTINGS->beginGroup("Appearance");
{
bool showSplash=RS_SETTINGS->readNumEntry("/ShowSplash",1)==1;
if(showSplash){
splash = new QSplashScreen(*pixmap);
splash->show();
splash->showMessage(QObject::tr("Loading.."),
Qt::AlignRight|Qt::AlignBottom, QC_SPLASH_TXTCOL);
RS_DEBUG->print("main: splashscreen: OK");
}
}
RS_SETTINGS->endGroup();
#endif
//QApplication::setStyle(new QWindowsStyle());
//QApplication::setStyle(new QPlatinumStyle());
#ifdef QC_BUILTIN_STYLE //js:
RS_DEBUG->print("main: applying built in style..");
applyBuiltinStyle();
#endif
RS_DEBUG->print("main: creating main window..");
QC_ApplicationWindow * appWin = new QC_ApplicationWindow();
RS_DEBUG->print("main: setting caption");
appWin->setWindowTitle(XSTR(QC_APPNAME));
RS_DEBUG->print("main: show main window");
appWin->show();
RS_DEBUG->print("main: set focus");
appWin->setFocus();
RS_DEBUG->print("main: creating main window: OK");
#ifdef QSPLASHSCREEN_H
if (splash) {
RS_DEBUG->print("main: updating splash..");
splash->showMessage(QObject::tr("Loading..."),
Qt::AlignRight|Qt::AlignBottom, QC_SPLASH_TXTCOL);
RS_DEBUG->print("main: processing events");
qApp->processEvents();
RS_DEBUG->print("main: updating splash: OK");
}
#endif
// Set LC_NUMERIC so that enetring numeric values uses . as teh decimal seperator
setlocale(LC_NUMERIC, "C");
RS_DEBUG->print("main: loading files..");
bool files_loaded = false;
for (QStringList::Iterator it = fileList.begin(); it != fileList.end();
++it ) {
#ifdef QSPLASHSCREEN_H
if (splash) {
splash->showMessage(QObject::tr("Loading File %1..")
.arg(QDir::toNativeSeparators(*it)),
Qt::AlignRight|Qt::AlignBottom, QC_SPLASH_TXTCOL);