Example #1
0
/**
 * @brief Displays the list of available filters
 * @param text Current text in the filter line edit
 */
void FilterWidget::onFilterTextChanged(QString text)
{
    if (text.length() < 3) {
        m_list->hide();
        return;
    }

    int height = 0;
    m_list->clear();
    foreach (Filter *filter, m_filters) {
        if (!filter->accepts(text))
            continue;

        if ((filter->info() == MovieFilters::Title || filter->info() == ConcertFilters::Title || filter->info() == TvShowFilters::Title)
            && !m_activeFilters.contains(filter)) {
            filter->setText(tr("Title contains \"%1\"").arg(text));
            filter->setShortText(text);
        }

        if ((filter->info() == MovieFilters::Path)
            && !m_activeFilters.contains(filter)) {
            filter->setText(tr("Filename contains \"%1\"").arg(text));
            filter->setShortText(text);
        }

        QListWidgetItem *item = new QListWidgetItem(filter->text(), m_list);
        item->setData(Qt::UserRole, QVariant::fromValue(filter));
        item->setBackgroundColor(QColor(255, 255, 255, 200));
        m_list->addItem(item);
        height += m_list->sizeHintForRow(m_list->count()-1);
    }

    if (m_list->count() > 0) {
        QFont font;
        font.setPixelSize(2);

        QListWidgetItem *topItem = new QListWidgetItem("");
        topItem->setFont(font);
        topItem->setBackgroundColor(QColor(255, 255, 255, 200));
        m_list->insertItem(0, topItem);
        height += m_list->sizeHintForRow(0);

        QListWidgetItem *bottomItem = new QListWidgetItem("");
        bottomItem->setBackgroundColor(QColor(255, 255, 255, 200));
        bottomItem->setFont(font);
        m_list->addItem(bottomItem);
        height += m_list->sizeHintForRow(m_list->count()-1);

        m_list->setFixedHeight(qMin(300, height));
        m_list->setFixedWidth(m_list->sizeHintForColumn(0)+5);
        m_list->move(ui->lineEdit->mapToGlobal(QPoint(ui->lineEdit->paddingLeft(), ui->lineEdit->height())));
        m_list->show();
    } else {
        m_list->hide();
    }
}
Example #2
0
int packagesPage::initPackagesLists()
{
    for (int i =0; i < packages.size(); i++)
    {
        //packagesList.clear();
        QListWidgetItem* repo = new QListWidgetItem(packages.at(i).first);

        QVector<QListWidgetItem*> listPackages;

        repo->setData(Qt::CheckStateRole, Qt::Unchecked);

		Qt::ItemFlags itemFlags;
        for (int p=0; p < packages.at(i).second.size(); p++)
        {
			//cout << packages.at(i).second.at(p).Name.toUtf8().constData() << endl;
            QListWidgetItem* packagesListItem = new QListWidgetItem(packages.at(i).second.at(p).Name);
            //package->setFlags((Qt::ItemFlag)((int)(~(packages.at(i).second.at(p).Critical))*Qt::ItemIsUserCheckable)|
            //                  Qt::ItemIsEnabled|);
            if(packages.at(i).second.at(p).Critical)
            {
				//itemFlags = 0;
				itemFlags = Qt::ItemIsEnabled;
				//DpackagesListItem->setFlags((Qt::ItemFlag)(~Qt::ItemIsUserCheckable|~Qt::ItemIsEditable));
                if(packages.at(i).second.at(p).Remove)
                {
                    //packagesListItem->setData(Qt::CheckStateRole, Qt::Unchecked);
                    packagesListItem->setCheckState(Qt::Unchecked);
                    packagesListItem->setBackgroundColor(QColor(Qt::darkRed));
                }
                else
                {
                    //packagesListItem->setData(Qt::CheckStateRole, Qt::Checked);
                    packagesListItem->setCheckState(Qt::Checked);
                    packagesListItem->setBackgroundColor(QColor(Qt::darkBlue));
                }
                packagesListItem->setForeground(QBrush(QColor(Qt::white)));

            }
            else
            {
				itemFlags = Qt::ItemIsUserCheckable | Qt::ItemIsSelectable | Qt::ItemIsEnabled;
                //packagesListItem->setData(Qt::CheckStateRole, Qt::Unchecked);
                packagesListItem->setCheckState(Qt::Unchecked);
            }
            
            packagesListItem->setFlags(itemFlags);
            listPackages.push_back(packagesListItem);
        }
        packagesList.push_back(qMakePair(repo, listPackages));
    }
    return 0;
}
Example #3
0
void ExportGesamt::reload()
{
    QListIterator<AActivity*> iter = manager->getActivities();
    int i = 0;
    while(iter.hasNext()) {
        AActivity *a = iter.next();
        if (actToList.contains(a)) {
            QString farbe = MainWindow::getFarbe(a);
            actToList.value(a)->setBackgroundColor(QColor(farbe));
            actToList.value(a)->setToolTip(a->getAnlass());
            i++;
            continue;
        }
        QString farbe = MainWindow::getFarbe(a);
        QListWidgetItem *item = new QListWidgetItem(a->getListString());
        item->setBackgroundColor(QColor(farbe));
        item->setToolTip(a->getAnlass());
        ui->listAnzeige->insertItem(i, item);
        liste.insert(i, a);
        actToList.insert(a, item);
        listToAct.insert(item, a);
        i++;
    }
    show();
}
void OptionsDialog::addToKeywordsList(const Keyword &keyword)
{
    QListWidgetItem *item = new QListWidgetItem(QIcon(keyword.iconResource), keyword.name);
    item->setData(Qt::UserRole, keyword.iconResource);
    item->setBackgroundColor(keyword.color);
    ui->keywordsList->addItem(item);
}
Example #5
0
void TimeTable::dropEvent(QDropEvent *event)
{
    qDebug()<<dragEnabled();
    if (event->mimeData()->hasFormat("timetable/item")) {
        if(!dragEnabled()){
            clear();
            setDragEnabled(true);
        }
         //Reading tasklist item properties
        QByteArray tmpd = event->mimeData()->data("timetable/item");
        QDataStream ds(&tmpd, QIODevice::ReadOnly);
        QColor color;
        QString str;
        QVariant duration;
        ds  >> color >> str >>duration;

        QListWidgetItem *item;
        item = new QListWidgetItem();
        item->setBackgroundColor(color);
        item->setText(str);
        item->setSizeHint(QSize(0,0));
        addItem(item);
        item->setData(1,duration);
        event->setDropAction(Qt::MoveAction);
        event->accept();
        refresh();
    }
}
Example #6
0
void Dialog::on_pushButton_clicked()
{
    QListWidgetItem *itm = ui->listWidget->currentItem();
    itm->setText("Fuzzy bunny");
    itm->setTextColor(Qt::cyan);
    itm->setBackgroundColor(Qt::black);
}
Example #7
0
void MainWindow::formChannelList(){

    if (m_availableChannelsQuery->getChannels().size() == 0 ) return;
    else
    {
        m_availableChannels = m_availableChannelsQuery->getChannels();
    }

    m_subscribedChannels = m_subscribedChannelsQuery->getChannels();

    QListWidget * listWidget = ui->channelsListWidget;
    QListWidget * subscribedListWidget = ui->subscribedListWidget;

    // Tab - channels
    while(listWidget->count()>0)
    {
      listWidget->takeItem(0);
    }

    foreach (Channel s, m_availableChannels){
        QListWidgetItem * item = new QListWidgetItem(s.getName());
        if (isSubscribed(s.getName())){
            item->setBackgroundColor(Qt::lightGray);
        }

        listWidget->addItem(item);
    }
Example #8
0
void OptionsDialog::addToKeywordsList(const Keyword &keyword)
{
    QListWidgetItem *item = new QListWidgetItem(
                icon(keyword.iconType), keyword.name);
    item->setData(Qt::UserRole, static_cast<int>(keyword.iconType));
    item->setBackgroundColor(keyword.color);
    ui->keywordsList->addItem(item);
}
Example #9
0
void Class20::on_pushButton_clicked()
{
	//ui.listWidget->currentItem()->setText("Busy Boy");
	QListWidgetItem *itm = ui.listWidget->currentItem();
	itm->setText("Busy Boy");
	itm->setTextColor(Qt::red);
	itm->setBackgroundColor(Qt::black);
}
Example #10
0
void AnnoqtConfEditor::slotAddItemAction()
{
  QListWidgetItem* item = new QListWidgetItem("New Type", m_listWidget);
  item->setFlags( item->flags() | Qt::ItemIsEditable );
  item->setCheckState(Qt::Unchecked);
  QColor color = m_colorPicker->color();
  item->setBackgroundColor(color);
  setWindowModified(true);
}
Example #11
0
void MaceListWidget::item_adder_general(int code, bool f){
    QString memory, name;
    QListWidgetItem *itm;
    int curCode, counter = 0;

    state = code;

    QMap<QString, fctnData >::iterator iter = itemSource->infos.begin();

    while(iter!=itemSource->infos.end()){

        curCode = iter.value().code;
        if (curCode == 200) {
            iter++;
            continue;
        }

        if (code == 100 || ((curCode-code >= 0) && (curCode-code < 10))){
            memory = iter.key();
            name = iter.value().name;

            itm = new QListWidgetItem(name);

            if(posChar){
                if(f){
                    if(curCode != 110 && curCode != 122 && curCode !=131 && curCode !=160 && curCode != 147 && !(curCode >= 170 && curCode < 180)){
                        itm->setData(100,memory);
                    }
                    else{
                        itm->setFlags(Qt::NoItemFlags);
                        itm->setData(100,"No");
                    }
                }
                else{
                    if(curCode == 121 || curCode == 140 || curCode == 130 || curCode>= 150 && curCode < 160){
                        itm->setData(100,memory);
                    }
                    else{
                        itm->setFlags(Qt::NoItemFlags);
                        itm->setData(100,"No");
                    }
                }
            }
            else{
                itm->setData(100,memory);
            }

            if(counter%2 == 0){itm->setBackgroundColor(QColor(235, 242, 233));}
            if (name!="No" || curCode >= 200) {counter++;}
            if(curCode > 0){this->addItem(itm);}

        }

        iter++;
    }
}
void TikzCommandInserter::addListWidgetItems(QListWidget *listWidget, const TikzCommandList &commandList, bool addChildren)
{
	QFont titleFont = qApp->font();
	titleFont.setBold(true);
//	QColor titleBg(QApplication::style()->standardPalette().color(QPalette::Normal, QPalette::Highlight));
//	titleBg = titleBg.lighter(120);
	QColor titleBg(QApplication::style()->standardPalette().color(QPalette::Normal, QPalette::Window));
	titleBg = titleBg.darker(200);
	QColor titleFg(QApplication::style()->standardPalette().color(QPalette::Normal, QPalette::HighlightedText));
	QColor separatorBg(QApplication::style()->standardPalette().color(QPalette::Normal, QPalette::AlternateBase));
	if (separatorBg == QApplication::style()->standardPalette().color(QPalette::Normal, QPalette::Base))
		separatorBg = separatorBg.darker(110);

	for (int i = 0; i < commandList.commands.size(); ++i)
	{
		if (commandList.commands.at(i).type == -1) // if we have an empty command corresponding to a submenu, then don't add the command, the submenus will be added later
			continue;

		QListWidgetItem *item = new QListWidgetItem(listWidget);
		QString itemText = commandList.commands.at(i).name;
		item->setText(itemText.remove('&'));

		if (itemText.isEmpty())
			item->setBackgroundColor(separatorBg);
		else
			item->setData(Qt::UserRole, commandList.commands.at(i).number); // link to the corresponding item in m_tikzCommandsList
	}

	if (!addChildren) return;

	for (int i = 0; i < commandList.children.size(); ++i)
	{
		QListWidgetItem *item = new QListWidgetItem(listWidget);
		QString itemText = commandList.children.at(i).title;
		item->setText(itemText.remove('&'));

		item->setBackgroundColor(titleBg);
		item->setTextColor(titleFg);
		item->setFont(titleFont);

		addListWidgetItems(listWidget, commandList.children.at(i));
	}
}
Example #13
0
void MainWindow::onGetRegInfo(vector<pair<QString, bool>> vec)
{
    ui->listWidget->clear();
    for(auto p : vec)
    {
        QListWidgetItem* item = new QListWidgetItem(p.first);
        auto color = p.second ? QColor(0,255,0) : QColor(255,0,0);
        //item->setTextColor(color);
        item->setBackgroundColor(color);
        ui->listWidget->addItem(item);
    }
}
Example #14
0
void Dialog::on_pushButton_clicked()
{
    // create a pointer to the current item..
    // easier than writing this code over and over again
    // D.R.Y. !!
    QListWidgetItem *item = ui->listWidget->currentItem();

    // plethora of things you can do with the list widget item
    // QListWidgetItem is a class from the QListWidget class
    item->setText("Chubby Bunny");
    item->setTextColor(Qt::white);
    item->setBackgroundColor(Qt::black);
}
Example #15
0
		void ListWidgetLogger::log(QString message, LogLevel priority) {
			QListWidgetItem* i = new QListWidgetItem(message, listWidget);

			// Levels: NoneLevel, DebugLevel, TimingLevel, InfoLevel, WarningLevel, CriticalLevel, AllLevel

			if ( priority == InfoLevel ) {
				i->setBackgroundColor(QColor(255,255,255));
			} else if ( priority == WarningLevel ) {
				parent->show();
				i->setBackgroundColor(QColor(255,243,73));
			} else if ( priority == CriticalLevel ) {
				parent->show();
				i->setBackgroundColor(QColor(255,2,0));
			} else if ( priority == TimingLevel ) {
				parent->show();
				i->setBackgroundColor(QColor(25,255,0));
			} else {
				i->setBackgroundColor(QColor(220,220,220));
			}
			listWidget->scrollToItem(i); 

		}
void CheckedListWidget::AddItem( QString itemText, QVariant data, bool setDisabled, QColor disabledColor )
{
    QListWidgetItem* item = new QListWidgetItem( itemText, this );
    item->setToolTip( itemText );
    item->setCheckState( Qt::Unchecked );
    item->setData( Qt::UserRole, data );

    if( setDisabled )
    {
        item->setFlags( Qt::NoItemFlags );
        item->setBackgroundColor( disabledColor );
    }

    addItem( item );
}
Example #17
0
void MainWindow::updateDevicesList(QVector<Device *> device)
{
    ui->listWidget->clear();
    for(int i=0;i<device.size();i++)
    {
        QString macaddress = device[i]->mac();
        QString logoname = m_wdevices->getDeviceLogoName(macaddress);

        WListWidgetItem *wListWidgetItem = new WListWidgetItem(this,logoname,device[i]->hostname(),
                                                               device[i]->mac());
        QListWidgetItem *listItem  = new QListWidgetItem();
        listItem->setSizeHint(QSize(0,wListWidgetItem->height()+1));
        listItem->setBackgroundColor(QColor(0,0,0));
        ui->listWidget->addItem(listItem);
        ui->listWidget->setItemWidget(listItem,wListWidgetItem);
    }
}
static QListWidgetItem* create_header_item(const char *pcTitle)
{
	QListWidgetItem *pHeaderItem = new QListWidgetItem(pcTitle);
	pHeaderItem->setTextAlignment(Qt::AlignHCenter);

	QFont fontHeader = pHeaderItem->font();
	fontHeader.setBold(1);
	pHeaderItem->setFont(fontHeader);

	QBrush brushHeader = pHeaderItem->foreground();
	brushHeader.setColor(QColor(0xff, 0xff, 0xff));
	pHeaderItem->setForeground(brushHeader);

	pHeaderItem->setData(Qt::UserRole, 1000);
	pHeaderItem->setBackgroundColor(QColor(0x65, 0x65, 0x65));

	return pHeaderItem;
}
Example #19
0
void OptionsDialog::editButtonClicked()
{
    QListWidgetItem *item = ui->keywordsList->currentItem();

    Keyword keyword;
    keyword.name = item->text();
    keyword.iconResource = item->data(Qt::UserRole).toString();
    keyword.color = item->backgroundColor();

    KeywordDialog *addKeywordDialog = new KeywordDialog(keyword, this);
    if (addKeywordDialog->exec() == QDialog::Accepted) {
        keyword = addKeywordDialog->keyword();
        item->setIcon(QIcon(keyword.iconResource));
        item->setText(keyword.name);
        item->setData(Qt::UserRole, keyword.iconResource);
        item->setBackgroundColor(keyword.color);
    }
}
Example #20
0
void GroupSelectionBox::fillGroups()
{
    std::list<RsNodeGroupId> selectedIds;
	selectedGroupIds(selectedIds);

	clear();

	std::list<RsGroupInfo> groupIds;
	rsPeers->getGroupInfoList(groupIds);

	for (std::list<RsGroupInfo>::const_iterator it(groupIds.begin()); it != groupIds.end(); ++it) {
		QListWidgetItem *item = new QListWidgetItem(GroupDefs::name(*it));
        item->setData(ROLE_ID, QString::fromStdString(it->id.toStdString()));
		item->setBackgroundColor(QColor(183,236,181));
		addItem(item);
	}

	setSelectedGroupIds(selectedIds);
}
Example #21
0
void ExportGesamt::hardReload()
{
    QListIterator<AActivity*> iter = manager->getActivities();
    liste = QList<AActivity*>();
    actToList = QMap<AActivity*, QListWidgetItem*>();
    listToAct = QMap<QListWidgetItem*, AActivity*>();
    ui->listAnzeige->clear();

    while(iter.hasNext()) {
        AActivity *a = iter.next();
        QString farbe = MainWindow::getFarbe(a);
        QListWidgetItem *item = new QListWidgetItem(a->getListString());
        item->setBackgroundColor(QColor(farbe));
        item->setToolTip(a->getAnlass());
        ui->listAnzeige->insertItem(ui->listAnzeige->count(), item);
        liste.append(a);
        actToList.insert(a, item);
        listToAct.insert(item, a);
    }
    show();
}
Example #22
0
void WtEditor::logCallback(void* opaque, const tdchar* tag, enum TdTraceLevel level, const tdchar* message){
	WtEditor* thiz = static_cast<WtEditor*>(opaque);

	QListWidgetItem* item = new QListWidgetItem(thiz->ui.logList);

	item->setText(QString(tag) + " : " + message);

	QColor color;

	switch(level){
	case eTD_LEVEL_VERBOSE:
		color = QColor(127, 127, 127);
		break;
	case eTD_LEVEL_DEBUG:
		color = QColor(255, 255, 255);
		break;
	case eTD_LEVEL_INFO:
		color = QColor(0, 255, 0);
		break;
	case eTD_LEVEL_WARNING:
		color = QColor(255, 100, 100);
		break;
	case eTD_LEVEL_ERROR:
		color = QColor(255, 0, 0);
		break;
	}

	item->setBackgroundColor(QColor(0, 0, 0));
	item->setTextColor(color);

	thiz->ui.logList->addItem(item);

	thiz->ui.logList->scrollToItem(item);
	thiz->ui.logList->setCurrentItem(item);

	if(thiz->ui.logList->count() > 10){
		thiz->ui.logList->removeItemWidget( thiz->ui.logList->item(0) );
		//delete thiz->ui.logList->takeItem(0);
	}
}
void ezQtEnginePluginConfigDlg::FillPluginList()
{
  ezPluginSet& Plugins = ezQtEditorApp::GetSingleton()->GetEnginePlugins();

  ListPlugins->blockSignals(true);

  for (auto it = Plugins.m_Plugins.GetIterator(); it.IsValid(); ++it)
  {
    QListWidgetItem* pItem = new QListWidgetItem();
    pItem->setFlags(Qt::ItemFlag::ItemIsEnabled | Qt::ItemFlag::ItemIsSelectable | Qt::ItemFlag::ItemIsUserCheckable);

    ezStringBuilder sText = it.Key();

    if (it.Value().m_bLoadCopy)
    {
      sText.Append(" (load copy)");
    }

    if (!it.Value().m_bAvailable)
    {
      sText.Append(" (missing)");

      pItem->setBackgroundColor(Qt::red);
    }
    else if (it.Value().m_bActive)
    {
      sText.Append(" (active)");
    }

    pItem->setText(sText.GetData());
    pItem->setData(Qt::UserRole + 1, QString(it.Key().GetData()));
    pItem->setCheckState(it.Value().m_bToBeLoaded ? Qt::CheckState::Checked : Qt::CheckState::Unchecked);
    ListPlugins->addItem(pItem);
  }

  ListPlugins->blockSignals(false);
}
Example #24
0
void    Home::addContact(UserInfo *added)
{
	QListWidgetItem *item;
	QFont			font;
	QPushButton		*but;
	QString			name;
	QPixmap			*pixmap = NULL;
	QPalette		palette;
	t_contact		*ptr = new t_contact;
	std::string		tmp;
	int				state;


	state = added->get_status();
	if (state < 1 && state > 4)
		state = 4;
	item = new QListWidgetItem();
	tmp = added->get_name() + " " + added->get_surname();
	name = tmp.c_str();
	item->setText(name);
	item->setTextAlignment(21);
	item->setBackgroundColor(QColor(255, 255, 255));
	font.setPointSize(12);
	font.setFamily("calibri");
	item->setFont(font);
	font.setPointSize(8);
	ui->_listContact->addItem(item);
	but = new QPushButton(added->get_nickname().c_str());
	but->setFlat(true);
	switch (state)
	{
	case 2:
		pixmap = new QPixmap("./Images/BabelHD_0001s_0005s_0002_status.png");
		break;
	case 3:
		pixmap = new QPixmap("./Images/BabelHD_0001s_0003s_0000_status.png");
		break;
	case 4:
		pixmap = new QPixmap("./Images/BabelHD_0001s_0000s_0000_status.png");
		break;
	case 1:
		pixmap = new QPixmap("./Images/BabelHD_0001s_0002s_0000_status.png");
		break;
	default:
		break;
	}
	if (pixmap != NULL)
		palette.setBrush(but->backgroundRole(), QBrush(*pixmap));
	but->setFlat(true);
	but->setAutoFillBackground(true);
	but->setPalette(palette);
	but->setFont(font);
	but->setMinimumSize(250, 42);
	but->setMaximumSize(250, 42);
	std::stringstream ss;
	ss << added->get_id();
	ss >> tmp;
	but->setObjectName(tmp.c_str());
	but->setStyleSheet("text-align: middle");
	connect(but, SIGNAL(clicked()), this, SLOT(contactClick()));
	QHBoxLayout *layout = new QHBoxLayout();
	layout->addWidget(but);
	layout->alignment();
	ptr->but = but;
	ptr->item = item;
	_bcontact[added->get_id()] = ptr;
	QWidget *widget = new QWidget();
	widget->setLayout(layout);
	item->setSizeHint(widget->sizeHint());
	ui->_listContact->setItemWidget(item, widget);
}
Example #25
0
void GroupTab::consolidatePeers(map<string,string> peers, map<QString,Tab*> *tabPt, QTabWidget *tabs) {
	/*
	* TODO:
	* Cleanup this entire function
	*/
	// Create map of peers by IP
	map<string,string> peers_by_IP;
	map<string,string>::iterator it0;
	for (it0 = peers.begin(); it0 != peers.end(); it0++) {
		peers_by_IP.insert(std::pair<string,string>(it0->second,it0->first));
	}
	// Create a map of tabs open by <IP:Port,*Tab>
	map<QString,Tab*> ipMap;
	map<QString,Tab*>::iterator it1;
	for (it1 = tabPt->begin(); it1 != tabPt->end(); it1++) {
		ipMap.insert(std::pair<QString,Tab*>(it1->second->toolTip(),it1->second));
		// If peer has disconnected disable tab
		if (it1->second->tabType().compare("PEER") == 0 &&
		        peers_by_IP.find(it1->second->toolTip().toStdString()) == peers_by_IP.end()) {
			it1->second->setEnabled(false);
		}
	}

	// Iterator for peer map
	map<string,string>::iterator it;

	// Clear old peers
	online->clear();

	for (it=peers.begin(); it != peers.end(); it++) {
		// Check if tab is open by IP
		map<QString,Tab*>::iterator oldTab = ipMap.find(QString::fromStdString(it->second));
		if (oldTab != ipMap.end()) {
			// If open, enable and set nickname
			oldTab->second->setEnabled(true);
			// Change peername in tabPt
			tabPt->erase(tabs->tabText(tabs->indexOf(oldTab->second)));
			tabPt->insert(std::pair<QString,Tab*>(QString::fromStdString(it->first),oldTab->second));
			// Set tab text to new peer name
			tabs->setTabText(tabs->indexOf(oldTab->second),QString::fromStdString(it->first));
			// Change peer name in PeerTab, so it sends to the right person
			(static_cast<PeerTab *>(oldTab->second))->peer(QString::fromStdString(it->first));
		}

		QListWidgetItem *item = new QListWidgetItem(QString::fromStdString(it->first));

		// Set tooltip as IP:Port
		item->setToolTip(QString::fromStdString(it->second));

		online->addItem(item);
		// Check if it's you
		if (client->nick().compare(it->first) == 0) {
			// Set background color to red
			item->setBackgroundColor(QColor(255,0,0,20));
		} else {
			// Assign color to peers
			// Make it look good to (use scaling hue along HSV scale)
			item->setTextColor(QColor::fromHsv(nextHue(),255,175));
		}
	}
}
void MainWindowController::slotEnterDefSquare(int index) {
    QListWidgetItem* lWidget = view->getUi()->definitionWidget->item(index-1);
    lWidget->setBackgroundColor(QColor(Qt::red));
    selectedItem = lWidget;
}
void MainWindowController::slotExitDefSquare(int index) {
    selectedItem = nullptr;
    QListWidgetItem* lWidget = view->getUi()->definitionWidget->item(index-1);
    lWidget->setBackgroundColor(QColor(Qt::white));
}