Fading Effect in Veins 4.4 demo example - veins

I wanted to know whether fading effect is already included in the example scenario of veins 4.4?If not how to include different fading models in the simulation ??

Fading models in the simulation are instantiated from a list in an XML file, for example https://github.com/sommer/veins/blob/veins-4.4/examples/veins/config.xml - if you want to use additional or alternative models, you can find some more in https://github.com/sommer/veins/tree/veins-4.4/src/veins/modules/analogueModel

Related

QTreeView scroll to current row after sort

I'm adapting QT Creator Basic Sort/Filter Model Example to work with my own source data (my movie library). That link shows what the example display looks like, and here's a link to the relatively small amount of source code. I don't really understand everything I'm doing, but mostly things have gone well until I hit this current problem...
How can I update the view so currently-selected row ALWAYS stays visible after changing sort order?
I hope someone will tell me exactly what C++ code needs to added / modified in the actual example program. There's probably no point in posting links to QT documentation, or "similar" code doing much the same thing in other contexts, because I don't think I'll be able to understand how to adapt such information to my own needs.
I'm using latest QT Creator 6.0.2 running under latest Linux Mint 20.3 Cinnamon, but I'm not sure that makes any difference, and I don't know what if any other information might be relevant.
EDIT:
I assume the extra code to force "scroll to current selection after sort" logically fits in QT Creator source code file examples/ widgets/ itemviews/ basicsortfiltermodel/ window.cpp
I commented out line 122 in that file (suppress display of the "source" table, because I only want the "proxy" view). Other than that, the source file in my derived project is identical to the original as held here on GitHub (along with the header & main source for the example project, per my second link above).
Effectively, I'm asking for the smallest possible change to the actual example project code to ensure the currently selected line never disappears from view after sorting.
The exact example from QT documentation has less than a dozen rows of data, so exact control of display positioning doesn't matter much. But I'll normally have a lot of rows visible, and the currently selected row could appear at any position within the visible window. Sometimes, "current row" might not actually be visible before a sort, but I'd like it to always be visible after.
It might be asking a lot, but I'd be seriously impressed if anyone comes up with succinct code to ensure that wherever possible, the currently highlighted row stays in position (doesn't jump up or down) while the rows above and/or below change as a result of sorting.
If you want to scroll to current row after sorting, then I would suggest doing the following four changes to your code.
You should implemented your own model by inheriting from QStandardItemModel and in this derived model class:
add a signal sorted() to your model class
override virtual method sort() (https://doc.qt.io/qt-5/qabstractitemmodel.html#sort)
void YourModel::sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override
{
QStadardItemModel::sort(column, order);
emit sorted(); // this is the signal you added
}
Then create a method which will access the tree view and would do this:
void scrollAfterSort()
{
treeView->scrollTo(treeView->currentIndex());
}
Connect YourModel::sorted() signal to this scrollAfterSort() method.

Is there a practical way of creating wxPanel over another wxPanel?

There are two main panels used for different purposes. One of the panels is used for making some drawings, using dc(Panel-D), the other one contains some buttons for getting user inputs(Panel-I). The issue is about the placement of these two panels. I am trying to place Panel-I over Panel-D as shown below(like always on top option). The difficulty in this matter, I couldn't put Panel-I in Panel-D, because we can't intervene the drawing functions on Panel-D.
I tried using different techniques with various types of wxSizers and wxSizerFlags, but couldn't get the desired orientation/placement. I would be grateful to any suggestion.
You should have no trouble with this if you create Panel-I as a child of Panel-D. You can then position it in any way you want: either manually (e.g. if its position is fixed), or using sizers.

Django - should ImageField be built-in to same app, or implemented in a separate app?

For example, there are two applications cars and houses, both of them currently have a models.ManyToManyField to a model with a models.ImageField(upload_to='img/[APP_NAME].
Instead of copying and pasting that snippet of ImageField code, is it better to split the image upload into a a separate application and import it? What should it look like?
There's no clear answer on your question. It highly depends on what you want to achieve.
With making a separate app, that only knows about images, you will have the following problems:
You want different upload_to for your cars and houses. You will need to set it dynamically. Example.
Your image model (the one with ImageField) will know about both cars and houses, via related_name property. I don't find it to be any good. To get rid of the backreferences, you can specify ManyToMany(..., related_name="+"). Note: "+" means no related name given and it shouldn't be auto-generated. But the reasonability of removing it is also questionable.
One more app, that does... well, nothing. One more dependency for each of your apps.
On your place I would just leave both model images, one in cars, another in houses. That's considering the amount of boilerplate code you will have to write and amount of problems you would create for yourself out of nowhere.

What is the appropriate way to check that I am on a particular screen in Calabash testing?

I'm looking to assert that I am on a particular screen during my tests, and if I'm not, then I should fail. What is the recommended way of doing this? For example, if I have a test like this:
Given that I am on the Login screen
When I press "Sign Up"
Then I should be on the Sign up screen
I've written Page Object Models for both screens involved, and they each have a trait method defined.
I've looked, and there is the TaskyPro sample (https://github.com/xamarin/mobile-samples/tree/master/TaskyPro-Calabash/features/step_definitions), which defines an "assert_screen" method. I've tried putting it into my project, but it doesn't work, as #screen is always nil. I don't have Xamarin, so I can't build their project and test it out.
You need to assign #screen first.
If your screen objects inherent from Calabash::IBase (iOS) or Calabash::ABase (Android), you could use the built in await method. You just have to set a trait or title for the screen.
A good example is the "Calabash Cross Platform Example": https://github.com/calabash/x-platform-example
In there you can see examples of how to assign screen/page objects, how to make screen/page objects and how to check if a screen is visible.
We use screen objects all over our tests, and they help a lot when you need to use the same tests on multiple platforms.
I would recommend that you also use the transition method on the screen/page objects to navigate between screens.

Use QItemDelegate to show image thumbnails

What's the best way to use QT4's QItemDelegate to show thumbnails for images in a view?
Specifically, how do you stop the item delegate from blocking when generating pixmaps from very large image files (> 500MB)?
Can anyone link to some example code that achieves this? Then again, perhaps this isn't the place to look for Qt-specific code.
You're doing it wrong if you are generating pixmaps inside any of the delegate methods (paint, draw...).
Try to generate the thumbnails only once (on worker thread or maybe not even at runtime, if possible) and have the delegate just display them for the appropriate role.
If you do it at runtime display a default picture until you have the thumbnail generated (like web browsers do with pictures that are not yet downloaded).