本文整理汇总了C++中TilesetView::setZoomable方法的典型用法代码示例。如果您正苦于以下问题:C++ TilesetView::setZoomable方法的具体用法?C++ TilesetView::setZoomable怎么用?C++ TilesetView::setZoomable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TilesetView
的用法示例。
在下文中一共展示了TilesetView::setZoomable方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createTilesetView
void TilesetDock::createTilesetView(int index, TilesetDocument *tilesetDocument)
{
auto tileset = tilesetDocument->tileset();
mTilesets.insert(index, tileset);
mTilesetDocuments.insert(index, tilesetDocument);
TilesetView *view = new TilesetView;
view->setZoomable(mZoomable);
// Insert view before the tab to make sure it is there when the tab index
// changes (happens when first tab is inserted).
mViewStack->insertWidget(index, view);
mTabBar->insertTab(index, tileset->name());
connect(tilesetDocument, &TilesetDocument::tilesetNameChanged,
this, &TilesetDock::tilesetNameChanged);
connect(tilesetDocument, &TilesetDocument::fileNameChanged,
this, &TilesetDock::updateActions);
connect(tilesetDocument, &TilesetDocument::tilesetChanged,
this, &TilesetDock::tilesetChanged);
connect(tilesetDocument, &TilesetDocument::tileImageSourceChanged,
this, &TilesetDock::tileImageSourceChanged);
connect(tilesetDocument, &TilesetDocument::tileAnimationChanged,
this, &TilesetDock::tileAnimationChanged);
}
示例2: tilesetAdded
void TilesetDock::tilesetAdded(int index, Tileset *tileset)
{
TilesetView *view = new TilesetView;
view->setMapDocument(mMapDocument);
view->setZoomable(mZoomable);
mTilesets.insert(index, tileset->sharedPointer());
mTabBar->insertTab(index, tileset->name());
mViewStack->insertWidget(index, view);
updateActions();
}
示例3: setMapDocument
void TilesetDock::setMapDocument(MapDocument *mapDocument)
{
if (mMapDocument == mapDocument)
return;
// Hide while we update the tab bar, to avoid repeated layouting
widget()->hide();
setCurrentTiles(0);
if (mMapDocument) {
// Remember the last visible tileset for this map
const QString tilesetName = mTabBar->tabText(mTabBar->currentIndex());
mCurrentTilesets.insert(mMapDocument, tilesetName);
}
// Clear previous content
while (mTabBar->count())
mTabBar->removeTab(0);
while (mViewStack->count())
delete mViewStack->widget(0);
mTilesets.clear();
// Clear all connections to the previous document
if (mMapDocument)
mMapDocument->disconnect(this);
mMapDocument = mapDocument;
if (mMapDocument) {
mTilesets = mMapDocument->map()->tilesets();
foreach (Tileset *tileset, mTilesets) {
TilesetView *view = new TilesetView;
view->setMapDocument(mMapDocument);
view->setZoomable(mZoomable);
mTabBar->addTab(tileset->name());
mViewStack->addWidget(view);
}
connect(mMapDocument, SIGNAL(tilesetAdded(int,Tileset*)),
SLOT(tilesetAdded(int,Tileset*)));
connect(mMapDocument, SIGNAL(tilesetRemoved(Tileset*)),
SLOT(tilesetRemoved(Tileset*)));
connect(mMapDocument, SIGNAL(tilesetMoved(int,int)),
SLOT(tilesetMoved(int,int)));
connect(mMapDocument, SIGNAL(tilesetNameChanged(Tileset*)),
SLOT(tilesetNameChanged(Tileset*)));
connect(mMapDocument, SIGNAL(tilesetFileNameChanged(Tileset*)),
SLOT(updateActions()));
QString cacheName = mCurrentTilesets.take(mMapDocument);
for (int i = 0; i < mTabBar->count(); ++i) {
if (mTabBar->tabText(i) == cacheName) {
mTabBar->setCurrentIndex(i);
break;
}
}
}
示例4: setMapDocument
void TilesetDock::setMapDocument(MapDocument *mapDocument)
{
if (mMapDocument == mapDocument)
return;
// Hide while we update the tab bar, to avoid repeated layouting
// But, this causes problems on OS X (issue #1055)
#ifndef Q_OS_OSX
widget()->hide();
#endif
setCurrentTiles(nullptr);
setCurrentTile(nullptr);
if (mMapDocument) {
// Remember the last visible tileset for this map
const QString tilesetName = mTabBar->tabText(mTabBar->currentIndex());
mCurrentTilesets.insert(mMapDocument, tilesetName);
}
// Clear previous content
while (mTabBar->count())
mTabBar->removeTab(0);
while (mViewStack->count())
delete mViewStack->widget(0);
mTilesets.clear();
// Clear all connections to the previous document
if (mMapDocument)
mMapDocument->disconnect(this);
mMapDocument = mapDocument;
if (mMapDocument) {
mTilesets = mMapDocument->map()->tilesets();
for (const SharedTileset &tileset : mTilesets) {
TilesetView *view = new TilesetView;
view->setMapDocument(mMapDocument);
view->setZoomable(mZoomable);
mTabBar->addTab(tileset->name());
mViewStack->addWidget(view);
}
connect(mMapDocument, &MapDocument::tilesetAdded,
this, &TilesetDock::tilesetAdded);
connect(mMapDocument, &MapDocument::tilesetRemoved,
this, &TilesetDock::tilesetRemoved);
connect(mMapDocument, &MapDocument::tilesetMoved,
this, &TilesetDock::tilesetMoved);
connect(mMapDocument, &MapDocument::tilesetReplaced,
this, &TilesetDock::tilesetReplaced);
connect(mMapDocument, &MapDocument::tilesetNameChanged,
this, &TilesetDock::tilesetNameChanged);
connect(mMapDocument, &MapDocument::tilesetFileNameChanged,
this, &TilesetDock::updateActions);
connect(mMapDocument, &MapDocument::tilesetChanged,
this, &TilesetDock::tilesetChanged);
connect(mMapDocument, &MapDocument::tileImageSourceChanged,
this, &TilesetDock::tileImageSourceChanged);
connect(mMapDocument, &MapDocument::tileAnimationChanged,
this, &TilesetDock::tileAnimationChanged);
QString cacheName = mCurrentTilesets.take(mMapDocument);
for (int i = 0; i < mTabBar->count(); ++i) {
if (mTabBar->tabText(i) == cacheName) {
mTabBar->setCurrentIndex(i);
break;
}
}
if (Object *object = mMapDocument->currentObject())
if (object->typeId() == Object::TileType)
setCurrentTile(static_cast<Tile*>(object));
}
updateActions();
#ifndef Q_OS_OSX
widget()->show();
#endif
}