本文整理汇总了C++中GenericChatroomWidget类的典型用法代码示例。如果您正苦于以下问题:C++ GenericChatroomWidget类的具体用法?C++ GenericChatroomWidget怎么用?C++ GenericChatroomWidget使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GenericChatroomWidget类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: findPreviousWidget
void NotificationScrollArea::findPreviousWidget()
{
int value = 0;
GenericChatroomWidget* next = nullptr;
QHash<GenericChatroomWidget*, Visibility>::iterator i = trackedWidgets.begin();
// Find the first next, to avoid nullptr.
for (; i != trackedWidgets.end(); ++i)
{
if (i.value() == Above)
{
next = i.key();
value = next->mapTo(viewport(), QPoint()).y();
break;
}
}
// Try finding a closer one.
for (; i != trackedWidgets.end(); ++i)
{
if (i.value() == Above)
{
int y = i.key()->mapTo(viewport(), QPoint()).y();
if (y > value)
{
next = i.key();
value = y;
}
}
}
if (next != nullptr)
ensureWidgetVisible(next, 0, referencesAbove != 1 ? topEdge->height() : 0);
}
示例2: updateStatus
void ContentDialog::updateStatus(int id, const QHash<int, std::tuple<ContentDialog *, GenericChatroomWidget *> > &list)
{
auto iter = list.find(id);
if (iter == list.end())
return;
GenericChatroomWidget* chatroomWidget = std::get<1>(iter.value());
chatroomWidget->updateStatusLight();
if (chatroomWidget->isActive())
std::get<0>(iter.value())->updateTitle(chatroomWidget);
}
示例3: if
bool CategoryWidget::cycleContacts(FriendWidget* activeChatroomWidget, bool forward)
{
int index = -1;
QLayout* currentLayout = nullptr;
FriendWidget* friendWidget = qobject_cast<FriendWidget*>(activeChatroomWidget);
if (friendWidget == nullptr)
return false;
currentLayout = listLayout->getLayoutOnline();
index = listLayout->indexOfFriendWidget(friendWidget, true);
if (index == -1)
{
currentLayout = listLayout->getLayoutOffline();
index = listLayout->indexOfFriendWidget(friendWidget, false);
}
index += forward ? 1 : -1;
for (;;)
{
// Bounds checking.
if (index < 0)
{
if (currentLayout == listLayout->getLayoutOffline())
currentLayout = listLayout->getLayoutOnline();
else
return false;
index = currentLayout->count() - 1;
continue;
}
else if (index >= currentLayout->count())
{
if (currentLayout == listLayout->getLayoutOnline())
currentLayout = listLayout->getLayoutOffline();
else
return false;
index = 0;
continue;
}
GenericChatroomWidget* chatWidget = qobject_cast<GenericChatroomWidget*>(currentLayout->itemAt(index)->widget());
if (chatWidget != nullptr)
emit chatWidget->chatroomWidgetClicked(chatWidget);
return true;
}
return false;
}
示例4: switch
bool ContentDialog::event(QEvent* event)
{
switch (event->type())
{
case QEvent::WindowActivate:
if (activeChatroomWidget != nullptr)
{
activeChatroomWidget->resetEventFlags();
activeChatroomWidget->updateStatusLight();
updateTitle(activeChatroomWidget);
Friend* frnd = activeChatroomWidget->getFriend();
Group* group = activeChatroomWidget->getGroup();
GenericChatroomWidget *widget = nullptr;
if (frnd)
widget = frnd->getFriendWidget();
else
widget = group->getGroupWidget();
widget->resetEventFlags();
widget->updateStatusLight();
Widget::getInstance()->updateScroll(widget);
Widget::getInstance()->resetIcon();
}
currentDialog = this;
#ifdef Q_OS_MAC
emit activated();
#endif
default:
break;
}
return ActivateDialog::event(event);
}
示例5: disconnect
void ContentDialog::removeGroup(int groupId)
{
Group* group = GroupList::findGroup(groupId);
if (group)
{
disconnect(group, &Group::titleChanged, this, &ContentDialog::updateGroupWidget);
disconnect(group, &Group::userListChanged, this, &ContentDialog::updateGroupWidget);
}
auto iter = groupList.find(groupId);
if (iter == groupList.end())
return;
GenericChatroomWidget* chatroomWidget = std::get<1>(iter.value());
if (activeChatroomWidget == chatroomWidget)
{
// Need to find replacement to show here instead.
cycleContacts(true, false);
}
groupLayout.removeSortedWidget(chatroomWidget);
chatroomWidget->deleteLater();
groupList.remove(groupId);
if (chatroomWidgetCount() == 0)
{
contentLayout->clear();
activeChatroomWidget = nullptr;
deleteLater();
}
else
{
update();
}
}
示例6: emitChatroomWidget
void CategoryWidget::emitChatroomWidget(QLayout* layout, int index)
{
GenericChatroomWidget* chatWidget = qobject_cast<GenericChatroomWidget*>(layout->itemAt(index)->widget());
if (chatWidget != nullptr)
emit chatWidget->chatroomWidgetClicked(chatWidget);
}
示例7: getDateFriend
void FriendListWidget::cycleContacts(GenericChatroomWidget* activeChatroomWidget, bool forward)
{
if (activeChatroomWidget == nullptr)
return;
int index = -1;
FriendWidget* friendWidget = dynamic_cast<FriendWidget*>(activeChatroomWidget);
if (mode == Activity)
{
if (friendWidget == nullptr)
return;
QDate activityDate = getDateFriend(FriendList::findFriend(friendWidget->friendId));
index = getTime(activityDate);
CategoryWidget* categoryWidget = dynamic_cast<CategoryWidget*>(activityLayout->itemAt(index)->widget());
if (categoryWidget == nullptr || categoryWidget->cycleContacts(friendWidget, forward))
return;
index += forward ? 1 : -1;
for (;;)
{
// Bounds checking.
if (index < Today)
{
index = Never;
continue;
}
else if (index > Never)
{
index = Today;
continue;
}
CategoryWidget* categoryWidget = dynamic_cast<CategoryWidget*>(activityLayout->itemAt(index)->widget());
if (categoryWidget != nullptr)
{
if (!categoryWidget->cycleContacts(forward))
{
// Skip empty or finished categories.
index += forward ? 1 : -1;
continue;
}
}
break;
}
return;
}
QLayout* currentLayout = nullptr;
CircleWidget* circleWidget = nullptr;
if (friendWidget != nullptr)
{
circleWidget = CircleWidget::getFromID(Settings::getInstance().getFriendCircleID(FriendList::findFriend(friendWidget->friendId)->getToxId()));
if (circleWidget != nullptr)
{
if (circleWidget->cycleContacts(friendWidget, forward))
return;
index = circleLayout->indexOfSortedWidget(circleWidget);
currentLayout = circleLayout->getLayout();
}
else
{
currentLayout = listLayout->getLayoutOnline();
index = listLayout->indexOfFriendWidget(friendWidget, true);
if (index == -1)
{
currentLayout = listLayout->getLayoutOffline();
index = listLayout->indexOfFriendWidget(friendWidget, false);
}
}
}
else
{
GroupWidget* groupWidget = dynamic_cast<GroupWidget*>(activeChatroomWidget);
if (groupWidget != nullptr)
{
currentLayout = groupLayout.getLayout();
index = groupLayout.indexOfSortedWidget(groupWidget);
}
else
{
return;
};
}
index += forward ? 1 : -1;
for (;;)
{
// Bounds checking.
if (index < 0)
{
//.........这里部分代码省略.........
示例8: getDateFriend
void FriendListWidget::cycleContacts(GenericChatroomWidget* activeChatroomWidget, bool forward)
{
if (!activeChatroomWidget) {
return;
}
int index = -1;
FriendWidget* friendWidget = qobject_cast<FriendWidget*>(activeChatroomWidget);
if (mode == Activity) {
if (!friendWidget) {
return;
}
QDate activityDate = getDateFriend(friendWidget->getFriend());
index = static_cast<int>(getTime(activityDate));
QWidget* widget = activityLayout->itemAt(index)->widget();
CategoryWidget* categoryWidget = qobject_cast<CategoryWidget*>(widget);
if (categoryWidget == nullptr || categoryWidget->cycleContacts(friendWidget, forward)) {
return;
}
index += forward ? 1 : -1;
for (;;) {
// Bounds checking.
if (index < 0) {
index = LAST_TIME;
continue;
} else if (index > LAST_TIME) {
index = 0;
continue;
}
widget = activityLayout->itemAt(index)->widget();
categoryWidget = qobject_cast<CategoryWidget*>(widget);
if (categoryWidget != nullptr) {
if (!categoryWidget->cycleContacts(forward)) {
// Skip empty or finished categories.
index += forward ? 1 : -1;
continue;
}
}
break;
}
return;
}
QLayout* currentLayout = nullptr;
CircleWidget* circleWidget = nullptr;
if (friendWidget != nullptr) {
const ToxPk& pk = friendWidget->getFriend()->getPublicKey();
uint32_t circleId = Settings::getInstance().getFriendCircleID(pk);
circleWidget = CircleWidget::getFromID(circleId);
if (circleWidget != nullptr) {
if (circleWidget->cycleContacts(friendWidget, forward)) {
return;
}
index = circleLayout->indexOfSortedWidget(circleWidget);
currentLayout = circleLayout->getLayout();
} else {
currentLayout = listLayout->getLayoutOnline();
index = listLayout->indexOfFriendWidget(friendWidget, true);
if (index == -1) {
currentLayout = listLayout->getLayoutOffline();
index = listLayout->indexOfFriendWidget(friendWidget, false);
}
}
} else {
GroupWidget* groupWidget = qobject_cast<GroupWidget*>(activeChatroomWidget);
if (groupWidget != nullptr) {
currentLayout = groupLayout.getLayout();
index = groupLayout.indexOfSortedWidget(groupWidget);
} else {
return;
};
}
index += forward ? 1 : -1;
for (;;) {
// Bounds checking.
if (index < 0) {
currentLayout = nextLayout(currentLayout, forward);
index = currentLayout->count() - 1;
continue;
} else if (index >= currentLayout->count()) {
currentLayout = nextLayout(currentLayout, forward);
index = 0;
continue;
}
// Go to the actual next index.
if (currentLayout == listLayout->getLayoutOnline()
//.........这里部分代码省略.........