本文整理汇总了C++中Tab::currentLink方法的典型用法代码示例。如果您正苦于以下问题:C++ Tab::currentLink方法的具体用法?C++ Tab::currentLink怎么用?C++ Tab::currentLink使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tab
的用法示例。
在下文中一共展示了Tab::currentLink方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: activateTab
bool DeclarativeTabModel::activateTab(const int &index)
{
if (index >= 0 && index < m_tabs.count()) {
Tab newActiveTab = m_tabs.at(index);
#ifdef DEBUG_LOGS
qDebug() << "active tab: " << index << newActiveTab.currentLink().url();
#endif
beginRemoveRows(QModelIndex(), index, index);
m_tabs.removeAt(index);
endRemoveRows();
// Current active tab back to model data.
if (m_activeTab.isValid()) {
#ifdef DEBUG_LOGS
qDebug() << "insert to first index: " << m_activeTab.currentLink().url() << m_activeTab.currentLink().title() << m_activeTab.currentLink().thumbPath();
#endif
beginInsertRows(QModelIndex(), 0, 0);
m_tabs.insert(0, m_activeTab);
endInsertRows();
}
updateActiveTab(newActiveTab);
return true;
}
return false;
}
示例2: removeTab
void DeclarativeTabModel::removeTab(const Tab &tab, int index)
{
#ifdef DEBUG_LOGS
qDebug() << "index:" << index << tab.currentLink().url();
#endif
int tabId = tab.tabId();
DBManager::instance()->removeTab(tabId);
QFile f(tab.currentLink().thumbPath());
if (f.exists()) {
f.remove();
}
if (index >= 0) {
m_tabs.removeAt(index);
}
}
示例3: tabChanged
void DeclarativeTabModel::tabChanged(Tab tab)
{
// When a tab was closed do not update anything from database as
// loading might be on going.
if (m_activeTabClosed && this->sender() == DBManager::instance()) {
m_activeTabClosed = false;
return;
}
#ifdef DEBUG_LOGS
qDebug() << "tab: " << tab.tabId() << m_activeTab.tabId() << tab.currentLink().thumbPath() << tab.currentLink().url() << tab.currentLink().title() << m_tabs.indexOf(tab);
#endif
if (tab.tabId() == m_activeTab.tabId()) {
updateActiveTab(tab);
} else {
int i = m_tabs.indexOf(tab); // match based on tab_id
if (i > -1) {
QVector<int> roles;
Tab oldTab = m_tabs[i];
if (oldTab.currentLink().url() != tab.currentLink().url()) {
roles << UrlRole;
}
if (oldTab.currentLink().title() != tab.currentLink().title()) {
roles << TitleRole;
}
if (oldTab.currentLink().thumbPath() != tab.currentLink().thumbPath()) {
roles << ThumbPathRole;
}
m_tabs[i] = tab;
QModelIndex start = index(i, 0);
QModelIndex end = index(i, 0);
emit dataChanged(start, end, roles);
}
}
}
示例4: getTab
void DBWorker::getTab(int tabId)
{
QSqlQuery query = prepare("SELECT tab_id, tab_history_id FROM tab WHERE tab_id = ?;");
query.bindValue(0, tabId);
if (!execute(query)) {
return;
}
if (query.first()) {
#ifdef DEBUG_LOGS
Tab tab = getTabData(query.value(0).toInt(), query.value(1).toInt());
qDebug() << query.value(0).toInt() << query.value(1).toInt() << tab.currentLink().title() << tab.currentLink().url();
#endif
emit tabAvailable(getTabData(query.value(0).toInt(), query.value(1).toInt()));
}
}
示例5: updateActiveTab
void DeclarativeTabModel::updateActiveTab(const Tab &newActiveTab, bool updateCurrentTab)
{
#ifdef DEBUG_LOGS
qDebug() << "change tab: " << updateCurrentTab << m_currentTab;
qDebug() << "old active tab: " << m_activeTab.tabId() << m_activeTab.isValid() << m_activeTab.currentLink().url() << m_tabs.count();
qDebug() << "new active tab: " << newActiveTab.tabId() << newActiveTab.isValid() << newActiveTab.currentLink().url();
#endif
m_activeTab = newActiveTab;
emit currentTabIdChanged();
saveTabOrder();
if (updateCurrentTab && m_currentTab) {
m_currentTab->tabChanged(m_activeTab);
}
}