How can I select the QGraphicView Item and change the properties
How can I select the
QGraphicView
items using mouse and change the properties(size,color).In this code I create Rectangles when the button clicks.But now I need to change properties of the rectangles.How can I select the each rectangle shapes using mouse and change the properties of the each one.
void Widget::on_btnCreateRect_clicked() { QBrush blueBrush(Qt::green); QPen blackPen(Qt::black); blackPen.setWidth(2); rect = ui->graphicsView->scene()->addRect(-10,-10,250,100,blackPen); rect->setFlag(QGraphicsItem::ItemIsMovable, true); }
http://doc.qt.io/qt-5/qtwidgets-graphicsview-diagramscene-example.html
In this example it can select square shapes and change the color of each squares.I need to do same thing and change the size of each shape,but I have no idea to do it.how can I do it?
Рекомендуем хостинг TIMEWEB
Стабильный хостинг, на котором располагается социальная сеть EVILEG. Для проектов на Django рекомендуем VDS хостинг.Вам это нравится? Поделитесь в социальных сетях!
Комментарии
Только авторизованные пользователи могут публиковать комментарии.
Пожалуйста, авторизуйтесь или зарегистрируйтесь
Пожалуйста, авторизуйтесь или зарегистрируйтесь
AD
- Akiv Doros
- 11 ноября 2024 г. 14:58
C++ - Тест 004. Указатели, Массивы и Циклы
- Результат:50баллов,
- Очки рейтинга-4
m
- molni99
- 26 октября 2024 г. 1:37
C++ - Тест 004. Указатели, Массивы и Циклы
- Результат:80баллов,
- Очки рейтинга4
m
- molni99
- 26 октября 2024 г. 1:29
C++ - Тест 004. Указатели, Массивы и Циклы
- Результат:20баллов,
- Очки рейтинга-10
Последние комментарии
Как написать игру на Qt - Урок 3. Взаимодействие с другими объектами what is priligy tablets What happens during the LASIK surgery process
Использование переменных объявленных в CMakeLists.txt внутри C++ файлов where can i buy priligy online safely Tom Platz How about things like we read about in the magazines like roid rage and does that really
Django - Урок 055. Как написать функционал auto populate field Freckles because of several brand names retin a, atralin buy generic priligy
QML - Урок 035. Использование перечислений в QML без C++ priligy cvs 24 Together with antibiotics such as amphotericin B 10, griseofulvin 11 and streptomycin 12, chloramphenicol 9 is in the World Health Organisation s List of Essential Medici…
Qt/C++ - Урок 052. Кастомизация Qt Аудио плеера в стиле AIMP It decreases stress, supports hormone balance, and regulates and increases blood flow to the reproductive organs buy priligy online safe Promising data were reported in a PDX model re…
Сейчас обсуждают на форуме
добавить qlineseries в функции Listen intently to what Jerry says about Conditional Acceptance because that s the bargaining chip in the song and dance you will have to engage in to protect yourself and your family from AMI S…
Всё ещё разбираюсь с кешем. priligy walgreens levitra dulcolax carbs The third ring was found to be made up of ultra relativistic electrons, which are also present in both the outer and inner rings
IscanderChe31 октября 2024 г. 15:43
Машина тьюринга // Начальное состояние 0 0, ,<,1 // Переход в состояние 1 при пустом символе 0,0,>,0 // Остаемся в состоянии 0, двигаясь вправо при встрече 0 0,1,>…
ИМ
Реализация навигации по разделам Спасибо Евгений!
Игорь Максимов3 октября 2024 г. 4:05
It is very big question.
First I give You idea, from that You can start, but some example I can write to you on weekend only.
Therefore, first, try to make changing of color.
For example, You need to make your own class from QGraphicsItem, or QGraphicsRectItem.
Example in this article . In this article You will find example of moving items on QGraphicsScene without flag ItemIsMovable. You need just to change logic to changing of color instead of moving the item.
Ok I'll check it sir,If you can please do article(tutorial) about this,Its really useful.Thank you
if you can give me some sample code when you free.thanks again
I found my old project, where I made simple Vector Editor. I wrote article about this editor and you will find link to project.
You can research it. In this project You will see, why I said your question is very big.
And It will be very cool, if have oportunities to share this article in some socials networks. Thanks.
Thank you very much sir,My next problem was how re - size the QGraphicViewItem (such as rectangle) using mouse,I think your project also have that function,thanks again :)
You are correct sir, this is a big question,most part of your solution I can't understand.If you can please explain your project sir.If you can please explain your code with each classes or please make some video tutorial with basic example,thank you
https://evileg.com/post/291/
I posted it here sir