@@ -419,10 +419,10 @@ void MainWindow::fill_personal_area()
419419{
420420 user_info_t info{this ->get_user_info ()};
421421
422- this ->pic = QPixmap ();
423- this ->pic .load (info.path_to_image );
422+ this ->profile_pic = QPixmap ();
423+ this ->profile_pic .load (info.path_to_image );
424424
425- this ->ui ->img_profile ->setPixmap (this ->pic );
425+ this ->ui ->img_profile ->setPixmap (this ->profile_pic );
426426 this ->ui ->show_login ->setText (" Логин: " + info.login );
427427}
428428
@@ -464,7 +464,7 @@ void MainWindow::fill_db_patterns(tinyxml2::XMLElement *body)
464464 QString path_to_image {QDir::currentPath () + " /images/" + name + " ." + img_type};
465465 this ->save_img_to_file (path_to_image, img_64);
466466
467- QSqlQuery inser (" INSERT INTO Pattern (name, description, code, path_to_image)"
467+ QSqlQuery insert (" INSERT INTO Pattern (name, description, code, path_to_image)"
468468 " VALUES ('" + name + " ', '" + description + " ', '" + code + " ', '" + path_to_image + " ')" );
469469
470470
@@ -548,6 +548,8 @@ void MainWindow::fill_patterns_list_form()
548548 this ->pattern_btn_more_list .push_back (new QPushButton (this ));
549549 this ->pattern_btn_more_list [i]->setText (" Подробнее" );
550550 this ->pattern_laoyut_list [i]->addWidget (this ->pattern_btn_more_list [i]);
551+ QString lambda{data[i]};
552+ connect (this ->pattern_btn_more_list [i], &QPushButton::clicked, [this , lambda] { this ->on_more_btn_clicked (lambda); });
551553
552554 this ->pattern_btn_test_list .push_back (new QPushButton (this ));
553555 this ->pattern_btn_test_list [i]->setText (" Тест" );
@@ -608,6 +610,32 @@ std::vector<QString> MainWindow::get_patterns_name()
608610 return res;
609611}
610612
613+ pattern_info_t MainWindow::get_pattern_info (QString name)
614+ {
615+ QSqlQuery query;
616+ if (!query.exec (" SELECT name, description, code, path_to_image FROM Pattern WHERE name = '" + name + " '" ))
617+ qDebug () << " ERROR" ;
618+
619+ query.next ();
620+
621+ return {query.value (0 ).toString (), query.value (1 ).toString (), query.value (2 ).toString (), query.value (3 ).toString ()};
622+ }
623+
624+ void MainWindow::on_more_btn_clicked (QString name)
625+ {
626+ this ->ui ->screen_stacked ->setCurrentIndex ((int )screen::more_pattern);
627+ this ->ui ->name_more ->setText (" Название: " + name);
628+
629+ pattern_info_t data{this ->get_pattern_info (name)};
630+ this ->ui ->description_more ->setText (data.description );
631+ this ->ui ->code_more ->setText (data.code );
632+
633+ this ->pattern_pic = QPixmap ();
634+ this ->pattern_pic .load (data.path_to_image );
635+
636+ this ->ui ->img_more ->setPixmap (this ->pattern_pic );
637+ }
638+
611639void MainWindow::on_to_register_clicked ()
612640{
613641 this ->ui ->screen_stacked ->setCurrentIndex ((int )screen::registration);
@@ -730,3 +758,8 @@ void MainWindow::on_update_patterns_clicked()
730758 connect (socket.get (), SIGNAL (readyRead ()), SLOT (slotReadyRead ()));
731759 connect (socket.get (), SIGNAL (errorOccurred (QAbstractSocket::SocketError)), this , SLOT (slotError (QAbstractSocket::SocketError)));
732760}
761+
762+ void MainWindow::on_to_pattern_list_clicked ()
763+ {
764+ this ->ui ->screen_stacked ->setCurrentIndex ((int )screen::patterns);
765+ }
0 commit comments