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, 2: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
Соңғы пікірлер
ИМ
Django - Оқулық 017. Теңшелген Django кіру беті Добрый вечер Евгений! Я сделал себе авторизацию аналогичную вашей, все работает, кроме возврата к предидущей странице. Редеректит всегда на главную, хотя в логах сервера вижу запросы на правильн…
Игорь МаксимовҚар. 22, 2024, 11:51 Т.Ж.
Evgenii LegotckoiҚаз. 31, 2024, 2:37 Т.Қ.
Qt Creator көмегімен fb3 файл оқу құралы Подскажите как это запустить? Я не шарю в программировании и кодинге. Скачал и установаил Qt, но куча ошибок выдается и не запустить. А очень надо fb3 переконвертировать в html
ИМ
Django - Сабақ 064. Python Markdown кеңейтімін қалай жазуға болады Приветствую Евгений! У меня вопрос. Можно ли вставлять свои классы в разметку редактора markdown? Допустим имея стандартную разметку: <ul> <li></li> <li></l…
Игорь МаксимовҚаз. 5, 2024, 7:51 Т.Ж.
QML - Сабақ 016. SQLite деректер қоры және онымен QML Qt-та жұмыс істеу Здравствуйте, возникает такая проблема (я новичок): ApplicationWindow неизвестный элемент. (М300) для TextField и Button аналогично. Могу предположить, что из-за более новой верси…
Енді форумда талқылаңыз
Mosquito Spray System Effective Mosquito Systems for Backyard | Eco-Friendly Misting Control Device & Repellent Spray - Moogo ; Upgrade your backyard with our mosquito-repellent device! Our misters conce…
Evgenii LegotckoiМаусым 24, 2024, 3:11 Т.Қ.
t
google domain [url=https://google.com/]domain[/url] domain [http://www.example.com link title]
tonypeachey1Қар. 15, 2024, 6:04 Т.Ж.
NSProjectМаусым 4, 2022, 3:49 Т.Ж.
IscanderCheҚаз. 31, 2024, 3:43 Т.Қ.
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